summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk7
-rw-r--r--NOTICE11
-rw-r--r--api/10.xml15
-rw-r--r--api/11.xml1114
-rw-r--r--api/9.xml15
-rw-r--r--api/current.xml924
-rw-r--r--core/java/android/app/Activity.java2
-rw-r--r--core/java/android/app/ApplicationPackageManager.java19
-rw-r--r--core/java/android/app/BackStackRecord.java8
-rw-r--r--core/java/android/app/DialogFragment.java6
-rw-r--r--core/java/android/app/DownloadManager.java36
-rw-r--r--core/java/android/app/Fragment.java6
-rw-r--r--core/java/android/app/FragmentBreadCrumbs.java4
-rw-r--r--core/java/android/app/FragmentManager.java62
-rw-r--r--core/java/android/app/FragmentTransaction.java7
-rw-r--r--core/java/android/app/LoaderManager.java12
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java69
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl3
-rw-r--r--core/java/android/content/AsyncTaskLoader.java9
-rw-r--r--core/java/android/content/BroadcastReceiver.java10
-rw-r--r--core/java/android/content/ClipData.java55
-rw-r--r--core/java/android/content/ClipboardManager.java4
-rw-r--r--core/java/android/content/CursorLoader.java29
-rw-r--r--core/java/android/content/XmlDocumentProvider.java2
-rw-r--r--core/java/android/content/pm/ActivityInfo.java17
-rw-r--r--core/java/android/content/pm/IPackageManager.aidl3
-rw-r--r--core/java/android/content/pm/PackageManager.java28
-rwxr-xr-xcore/java/android/content/pm/PackageStats.java8
-rw-r--r--core/java/android/database/DefaultDatabaseErrorHandler.java18
-rw-r--r--core/java/android/net/InterfaceConfiguration.java26
-rw-r--r--core/java/android/os/Environment.java21
-rw-r--r--core/java/android/os/StrictMode.java100
-rw-r--r--core/java/android/os/storage/StorageEventListener.java2
-rw-r--r--core/java/android/os/storage/StorageResultCode.java2
-rw-r--r--core/java/android/preference/Preference.java2
-rw-r--r--core/java/android/preference/PreferenceActivity.java12
-rw-r--r--core/java/android/view/GLES20Canvas.java6
-rw-r--r--core/java/android/view/View.java17
-rw-r--r--core/java/android/view/ViewGroup.java13
-rw-r--r--core/java/android/webkit/WebSettings.java11
-rw-r--r--core/java/android/webkit/WebStorage.java14
-rw-r--r--core/java/android/webkit/WebView.java67
-rw-r--r--core/java/android/webkit/ZoomManager.java9
-rw-r--r--core/java/android/widget/AbsListView.java1
-rw-r--r--core/java/android/widget/DatePicker.java6
-rw-r--r--core/java/android/widget/ExpandableListView.java7
-rw-r--r--core/java/android/widget/NumberPicker.java8
-rw-r--r--core/java/android/widget/RemoteViews.java25
-rw-r--r--core/java/android/widget/RemoteViewsAdapter.java15
-rw-r--r--core/java/android/widget/Spinner.java13
-rw-r--r--core/java/android/widget/TextView.java110
-rw-r--r--core/java/com/android/internal/app/ActionBarImpl.java2
-rw-r--r--core/java/com/android/internal/view/menu/MenuBuilder.java2
-rw-r--r--core/java/com/android/internal/widget/ActionBarContextView.java5
-rw-r--r--core/java/com/android/internal/widget/WaveView.java47
-rw-r--r--core/jni/android/graphics/BitmapFactory.cpp24
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp6
-rw-r--r--core/res/res/animator/fragment_fade_enter.xml (renamed from core/res/res/animator/fragment_next_enter.xml)0
-rw-r--r--core/res/res/animator/fragment_fade_exit.xml (renamed from core/res/res/animator/fragment_next_exit.xml)0
-rw-r--r--core/res/res/animator/fragment_prev_enter.xml28
-rw-r--r--core/res/res/animator/fragment_prev_exit.xml28
-rw-r--r--core/res/res/color/secondary_text_holo_dark.xml10
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_battery_0.pngbin1835 -> 2251 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_10.pngbin900 -> 1508 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_100.pngbin1807 -> 1807 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_20.pngbin895 -> 1625 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_40.pngbin1670 -> 1670 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_60.pngbin1706 -> 1706 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_80.pngbin1704 -> 1704 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_charge_anim0.pngbin1096 -> 1810 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_charge_anim1.pngbin1103 -> 1928 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_charge_anim2.pngbin1941 -> 1941 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_charge_anim3.pngbin1956 -> 1956 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_charge_anim4.pngbin1914 -> 1914 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_charge_anim5.pngbin2023 -> 2023 bytes
-rwxr-xr-x[-rw-r--r--]core/res/res/drawable-hdpi/stat_sys_battery_unknown.pngbin1170 -> 1449 bytes
-rw-r--r--core/res/res/drawable-mdpi/pointer_arrow.pngbin1327 -> 1336 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/btn_code_lock_default.pngbin0 -> 332 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/btn_code_lock_touched.pngbin0 -> 332 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_green_up.pngbin0 -> 860 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_red_up.pngbin0 -> 1129 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_default.pngbin0 -> 46951 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_green.pngbin0 -> 30670 bytes
-rw-r--r--core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_red.pngbin0 -> 26985 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.pngbin683 -> 298 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.pngbin1099 -> 298 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_green_up.pngbin659 -> 573 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_red_up.pngbin695 -> 729 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_default.pngbin9889 -> 23542 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_green.pngbin13199 -> 15734 bytes
-rw-r--r--core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_red.pngbin18083 -> 13778 bytes
-rw-r--r--core/res/res/layout/preference.xml27
-rw-r--r--core/res/res/layout/preference_category.xml1
-rw-r--r--core/res/res/layout/preference_category_holo.xml22
-rw-r--r--core/res/res/layout/preference_child_holo.xml75
-rw-r--r--core/res/res/layout/preference_holo.xml76
-rw-r--r--core/res/res/layout/preference_information.xml11
-rw-r--r--core/res/res/layout/preference_information_holo.xml64
-rwxr-xr-xcore/res/res/values/attrs.xml6
-rw-r--r--core/res/res/values/public.xml6
-rw-r--r--core/res/res/values/styles.xml56
-rw-r--r--core/res/res/values/themes.xml42
-rwxr-xr-xcore/tests/coretests/src/android/content/pm/PackageManagerTests.java159
-rw-r--r--docs/html/guide/developing/index.html8
-rw-r--r--docs/html/guide/guide_toc.cs6
-rw-r--r--docs/html/guide/topics/fragments/index.jd648
-rw-r--r--docs/html/guide/topics/fundamentals/fragments.jd815
-rw-r--r--docs/html/guide/topics/ui/actionbar.jd4
-rw-r--r--docs/html/images/fundamentals/fragments.pngbin0 -> 24022 bytes
-rw-r--r--docs/html/offline.jd71
-rw-r--r--docs/html/sdk/sdk_toc.cs22
-rw-r--r--graphics/java/android/graphics/Bitmap.java1
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java30
-rw-r--r--graphics/java/android/renderscript/Allocation.java83
-rw-r--r--graphics/java/android/renderscript/FileA3D.java30
-rw-r--r--graphics/java/android/renderscript/Matrix2f.java78
-rw-r--r--graphics/java/android/renderscript/Matrix3f.java131
-rw-r--r--graphics/java/android/renderscript/Matrix4f.java163
-rw-r--r--graphics/java/android/renderscript/Mesh.java25
-rw-r--r--graphics/java/android/renderscript/ProgramFragmentFixedFunction.java7
-rw-r--r--graphics/java/android/renderscript/ProgramVertexFixedFunction.java2
-rw-r--r--libs/hwui/DisplayListRenderer.cpp10
-rw-r--r--libs/hwui/DisplayListRenderer.h2
-rw-r--r--libs/hwui/FontRenderer.cpp19
-rw-r--r--libs/hwui/FontRenderer.h6
-rw-r--r--libs/hwui/Matrix.cpp18
-rw-r--r--libs/hwui/Matrix.h7
-rw-r--r--libs/hwui/OpenGLRenderer.cpp4
-rw-r--r--libs/hwui/OpenGLRenderer.h1
-rw-r--r--libs/rs/rsScriptC.cpp151
-rw-r--r--libs/rs/scriptc/rs_cl.rsh227
-rw-r--r--media/java/android/media/MediaScanner.java25
-rw-r--r--media/java/android/mtp/MtpDatabase.java18
-rw-r--r--media/jni/android_mtp_MtpDatabase.cpp7
-rw-r--r--media/libstagefright/AwesomePlayer.cpp13
-rw-r--r--media/libstagefright/NuCachedSource2.cpp9
-rw-r--r--media/libstagefright/include/NuCachedSource2.h4
-rw-r--r--media/libstagefright/rtsp/APacketSource.cpp12
-rw-r--r--media/mtp/MtpDatabase.h1
-rw-r--r--media/mtp/MtpServer.cpp13
-rw-r--r--opengl/java/android/opengl/GLSurfaceView.java50
-rw-r--r--packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.pngbin1950 -> 1440 bytes
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java3
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewManager.java14
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java2
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java38
-rw-r--r--services/input/PointerController.cpp12
-rw-r--r--services/java/com/android/server/ClipboardService.java8
-rw-r--r--services/java/com/android/server/DevicePolicyManagerService.java101
-rw-r--r--services/java/com/android/server/DropBoxManagerService.java17
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java28
-rw-r--r--services/java/com/android/server/PackageManagerService.java112
-rw-r--r--services/java/com/android/server/UsbService.java13
-rw-r--r--services/java/com/android/server/WindowManagerService.java19
-rw-r--r--services/java/com/android/server/connectivity/Tethering.java8
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java34
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java34
-rw-r--r--test-runner/src/android/test/mock/MockPackageManager.java14
-rw-r--r--tests/HwAccelerationTest/AndroidManifest.xml9
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java9
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java56
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java16
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ViewLayersActivity2.java2
-rw-r--r--tools/layoutlib/bridge/src/com/android/ide/common/resources/ResourceResolver.java560
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java54
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java10
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java10
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java8
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java12
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java154
-rw-r--r--voip/java/com/android/server/sip/SipService.java35
175 files changed, 4083 insertions, 3757 deletions
diff --git a/Android.mk b/Android.mk
index ad7027c5af15..f581515c0ad9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -366,7 +366,7 @@ framework_docs_LOCAL_DROIDDOC_OPTIONS := \
-since ./frameworks/base/api/7.xml 7 \
-since ./frameworks/base/api/8.xml 8 \
-since ./frameworks/base/api/9.xml 9 \
- -since ./frameworks/base/api/current.xml HC \
+ -since ./frameworks/base/api/current.xml Honeycomb \
-werror -hide 113 \
-overview $(LOCAL_PATH)/core/java/overview.html
@@ -436,15 +436,14 @@ web_docs_sample_code_flags := \
## SDK version identifiers used in the published docs
# major[.minor] version for current SDK. (full releases only)
-framework_docs_SDK_VERSION:=2.3
+framework_docs_SDK_VERSION:=3.0
# release version (ie "Release x") (full releases only)
-framework_docs_SDK_REL_ID:=1
+framework_docs_SDK_REL_ID:=Preview
framework_docs_LOCAL_DROIDDOC_OPTIONS += \
-hdf sdk.version $(framework_docs_SDK_VERSION) \
-hdf sdk.rel.id $(framework_docs_SDK_REL_ID) \
-hdf sdk.preview true \
- -hdf sdk.preview.version Honeycomb
# ==== the api stubs and current.xml ===========================
include $(CLEAR_VARS)
diff --git a/NOTICE b/NOTICE
index 8d6f583a1db6..d857ba30eef1 100644
--- a/NOTICE
+++ b/NOTICE
@@ -72,6 +72,17 @@ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied; not even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Audio Effects code. ==
+ =========================================================================
+
+Audio Effects
+These files are Copyright (C) 2004-2010 NXP Software and
+Copyright (C) 2010 The Android Open Source Project, but released under
+the Apache2 License.
+
Apache License
Version 2.0, January 2004
diff --git a/api/10.xml b/api/10.xml
index 3b9ab1a0edfc..15fcffe71640 100644
--- a/api/10.xml
+++ b/api/10.xml
@@ -157967,21 +157967,6 @@
<parameter name="flags" type="int">
</parameter>
</method>
-<method name="setPackageObbPath"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
</class>
<class name="MockResources"
extends="android.content.res.Resources"
diff --git a/api/11.xml b/api/11.xml
index 5b6765b888ee..5087eca259b7 100644
--- a/api/11.xml
+++ b/api/11.xml
@@ -1790,7 +1790,7 @@
type="int"
transient="false"
volatile="false"
- value="16843501"
+ value="16843499"
static="true"
final="true"
deprecated="not deprecated"
@@ -1812,7 +1812,7 @@
type="int"
transient="false"
volatile="false"
- value="16843510"
+ value="16843508"
static="true"
final="true"
deprecated="not deprecated"
@@ -1823,7 +1823,7 @@
type="int"
transient="false"
volatile="false"
- value="16843509"
+ value="16843507"
static="true"
final="true"
deprecated="not deprecated"
@@ -1834,7 +1834,7 @@
type="int"
transient="false"
volatile="false"
- value="16843511"
+ value="16843509"
static="true"
final="true"
deprecated="not deprecated"
@@ -1867,7 +1867,7 @@
type="int"
transient="false"
volatile="false"
- value="16843517"
+ value="16843515"
static="true"
final="true"
deprecated="not deprecated"
@@ -1889,7 +1889,7 @@
type="int"
transient="false"
volatile="false"
- value="16843513"
+ value="16843511"
static="true"
final="true"
deprecated="not deprecated"
@@ -1911,7 +1911,7 @@
type="int"
transient="false"
volatile="false"
- value="16843540"
+ value="16843538"
static="true"
final="true"
deprecated="not deprecated"
@@ -1922,7 +1922,7 @@
type="int"
transient="false"
volatile="false"
- value="16843539"
+ value="16843537"
static="true"
final="true"
deprecated="not deprecated"
@@ -1933,7 +1933,7 @@
type="int"
transient="false"
volatile="false"
- value="16843541"
+ value="16843539"
static="true"
final="true"
deprecated="not deprecated"
@@ -1944,7 +1944,7 @@
type="int"
transient="false"
volatile="false"
- value="16843512"
+ value="16843510"
static="true"
final="true"
deprecated="not deprecated"
@@ -1955,7 +1955,7 @@
type="int"
transient="false"
volatile="false"
- value="16843518"
+ value="16843516"
static="true"
final="true"
deprecated="not deprecated"
@@ -1966,7 +1966,7 @@
type="int"
transient="false"
volatile="false"
- value="16843519"
+ value="16843517"
static="true"
final="true"
deprecated="not deprecated"
@@ -2043,7 +2043,7 @@
type="int"
transient="false"
volatile="false"
- value="16843607"
+ value="16843605"
static="true"
final="true"
deprecated="not deprecated"
@@ -2065,7 +2065,7 @@
type="int"
transient="false"
volatile="false"
- value="16843531"
+ value="16843529"
static="true"
final="true"
deprecated="not deprecated"
@@ -2109,7 +2109,7 @@
type="int"
transient="false"
volatile="false"
- value="16843572"
+ value="16843570"
static="true"
final="true"
deprecated="not deprecated"
@@ -2142,7 +2142,7 @@
type="int"
transient="false"
volatile="false"
- value="16843553"
+ value="16843551"
static="true"
final="true"
deprecated="not deprecated"
@@ -2208,7 +2208,7 @@
type="int"
transient="false"
volatile="false"
- value="16843508"
+ value="16843506"
static="true"
final="true"
deprecated="not deprecated"
@@ -2274,7 +2274,7 @@
type="int"
transient="false"
volatile="false"
- value="16843548"
+ value="16843546"
static="true"
final="true"
deprecated="not deprecated"
@@ -2340,7 +2340,7 @@
type="int"
transient="false"
volatile="false"
- value="16843537"
+ value="16843535"
static="true"
final="true"
deprecated="not deprecated"
@@ -2450,7 +2450,7 @@
type="int"
transient="false"
volatile="false"
- value="16843550"
+ value="16843548"
static="true"
final="true"
deprecated="not deprecated"
@@ -2494,7 +2494,7 @@
type="int"
transient="false"
volatile="false"
- value="16843565"
+ value="16843563"
static="true"
final="true"
deprecated="not deprecated"
@@ -2582,7 +2582,7 @@
type="int"
transient="false"
volatile="false"
- value="16843526"
+ value="16843524"
static="true"
final="true"
deprecated="not deprecated"
@@ -2593,7 +2593,7 @@
type="int"
transient="false"
volatile="false"
- value="16843525"
+ value="16843523"
static="true"
final="true"
deprecated="not deprecated"
@@ -2626,7 +2626,7 @@
type="int"
transient="false"
volatile="false"
- value="16843569"
+ value="16843567"
static="true"
final="true"
deprecated="not deprecated"
@@ -2637,7 +2637,7 @@
type="int"
transient="false"
volatile="false"
- value="16843568"
+ value="16843566"
static="true"
final="true"
deprecated="not deprecated"
@@ -2703,7 +2703,7 @@
type="int"
transient="false"
volatile="false"
- value="16843598"
+ value="16843596"
static="true"
final="true"
deprecated="not deprecated"
@@ -3220,7 +3220,7 @@
type="int"
transient="false"
volatile="false"
- value="16843581"
+ value="16843579"
static="true"
final="true"
deprecated="not deprecated"
@@ -3275,7 +3275,7 @@
type="int"
transient="false"
volatile="false"
- value="16843595"
+ value="16843593"
static="true"
final="true"
deprecated="not deprecated"
@@ -3385,7 +3385,7 @@
type="int"
transient="false"
volatile="false"
- value="16843600"
+ value="16843598"
static="true"
final="true"
deprecated="not deprecated"
@@ -3451,7 +3451,7 @@
type="int"
transient="false"
volatile="false"
- value="16843530"
+ value="16843528"
static="true"
final="true"
deprecated="not deprecated"
@@ -3572,7 +3572,7 @@
type="int"
transient="false"
volatile="false"
- value="16843566"
+ value="16843564"
static="true"
final="true"
deprecated="not deprecated"
@@ -3583,7 +3583,7 @@
type="int"
transient="false"
volatile="false"
- value="16843564"
+ value="16843562"
static="true"
final="true"
deprecated="not deprecated"
@@ -3594,7 +3594,7 @@
type="int"
transient="false"
volatile="false"
- value="16843532"
+ value="16843530"
static="true"
final="true"
deprecated="not deprecated"
@@ -3825,7 +3825,7 @@
type="int"
transient="false"
volatile="false"
- value="16843604"
+ value="16843602"
static="true"
final="true"
deprecated="not deprecated"
@@ -3836,7 +3836,7 @@
type="int"
transient="false"
volatile="false"
- value="16843603"
+ value="16843601"
static="true"
final="true"
deprecated="not deprecated"
@@ -3946,7 +3946,7 @@
type="int"
transient="false"
volatile="false"
- value="16843534"
+ value="16843532"
static="true"
final="true"
deprecated="not deprecated"
@@ -4001,7 +4001,7 @@
type="int"
transient="false"
volatile="false"
- value="16843535"
+ value="16843533"
static="true"
final="true"
deprecated="not deprecated"
@@ -4199,7 +4199,7 @@
type="int"
transient="false"
volatile="false"
- value="16843575"
+ value="16843573"
static="true"
final="true"
deprecated="not deprecated"
@@ -4221,7 +4221,7 @@
type="int"
transient="false"
volatile="false"
- value="16843580"
+ value="16843578"
static="true"
final="true"
deprecated="not deprecated"
@@ -4232,7 +4232,7 @@
type="int"
transient="false"
volatile="false"
- value="16843577"
+ value="16843575"
static="true"
final="true"
deprecated="not deprecated"
@@ -4243,7 +4243,7 @@
type="int"
transient="false"
volatile="false"
- value="16843578"
+ value="16843576"
static="true"
final="true"
deprecated="not deprecated"
@@ -4254,7 +4254,7 @@
type="int"
transient="false"
volatile="false"
- value="16843611"
+ value="16843609"
static="true"
final="true"
deprecated="not deprecated"
@@ -4265,7 +4265,7 @@
type="int"
transient="false"
volatile="false"
- value="16843576"
+ value="16843574"
static="true"
final="true"
deprecated="not deprecated"
@@ -4276,7 +4276,7 @@
type="int"
transient="false"
volatile="false"
- value="16843579"
+ value="16843577"
static="true"
final="true"
deprecated="not deprecated"
@@ -4375,7 +4375,7 @@
type="int"
transient="false"
volatile="false"
- value="16843583"
+ value="16843581"
static="true"
final="true"
deprecated="not deprecated"
@@ -4430,7 +4430,7 @@
type="int"
transient="false"
volatile="false"
- value="16843589"
+ value="16843587"
static="true"
final="true"
deprecated="not deprecated"
@@ -4514,7 +4514,7 @@
visibility="public"
>
</field>
-<field name="fragmentNextEnterAnimation"
+<field name="fragmentFadeEnterAnimation"
type="int"
transient="false"
volatile="false"
@@ -4525,7 +4525,7 @@
visibility="public"
>
</field>
-<field name="fragmentNextExitAnimation"
+<field name="fragmentFadeExitAnimation"
type="int"
transient="false"
volatile="false"
@@ -4558,28 +4558,6 @@
visibility="public"
>
</field>
-<field name="fragmentPrevEnterAnimation"
- type="int"
- transient="false"
- volatile="false"
- value="16843499"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="fragmentPrevExitAnimation"
- type="int"
- transient="false"
- volatile="false"
- value="16843500"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="freezesText"
type="int"
transient="false"
@@ -4969,7 +4947,7 @@
type="int"
transient="false"
volatile="false"
- value="16843533"
+ value="16843531"
static="true"
final="true"
deprecated="not deprecated"
@@ -4980,7 +4958,7 @@
type="int"
transient="false"
volatile="false"
- value="16843551"
+ value="16843549"
static="true"
final="true"
deprecated="not deprecated"
@@ -5013,7 +4991,7 @@
type="int"
transient="false"
volatile="false"
- value="16843605"
+ value="16843603"
static="true"
final="true"
deprecated="not deprecated"
@@ -5068,7 +5046,7 @@
type="int"
transient="false"
volatile="false"
- value="16843516"
+ value="16843514"
static="true"
final="true"
deprecated="not deprecated"
@@ -5189,7 +5167,7 @@
type="int"
transient="false"
volatile="false"
- value="16843504"
+ value="16843502"
static="true"
final="true"
deprecated="not deprecated"
@@ -5200,7 +5178,7 @@
type="int"
transient="false"
volatile="false"
- value="16843502"
+ value="16843500"
static="true"
final="true"
deprecated="not deprecated"
@@ -5211,7 +5189,7 @@
type="int"
transient="false"
volatile="false"
- value="16843503"
+ value="16843501"
static="true"
final="true"
deprecated="not deprecated"
@@ -5321,7 +5299,7 @@
type="int"
transient="false"
volatile="false"
- value="16843546"
+ value="16843544"
static="true"
final="true"
deprecated="not deprecated"
@@ -5497,7 +5475,7 @@
type="int"
transient="false"
volatile="false"
- value="16843573"
+ value="16843571"
static="true"
final="true"
deprecated="not deprecated"
@@ -5596,7 +5574,7 @@
type="int"
transient="false"
volatile="false"
- value="16843567"
+ value="16843565"
static="true"
final="true"
deprecated="not deprecated"
@@ -5827,7 +5805,7 @@
type="int"
transient="false"
volatile="false"
- value="16843612"
+ value="16843610"
static="true"
final="true"
deprecated="not deprecated"
@@ -5860,7 +5838,7 @@
type="int"
transient="false"
volatile="false"
- value="16843606"
+ value="16843604"
static="true"
final="true"
deprecated="not deprecated"
@@ -6289,7 +6267,7 @@
type="int"
transient="false"
volatile="false"
- value="16843506"
+ value="16843504"
static="true"
final="true"
deprecated="not deprecated"
@@ -6333,7 +6311,7 @@
type="int"
transient="false"
volatile="false"
- value="16843527"
+ value="16843525"
static="true"
final="true"
deprecated="not deprecated"
@@ -6344,7 +6322,7 @@
type="int"
transient="false"
volatile="false"
- value="16843521"
+ value="16843519"
static="true"
final="true"
deprecated="not deprecated"
@@ -6432,7 +6410,7 @@
type="int"
transient="false"
volatile="false"
- value="16843529"
+ value="16843527"
static="true"
final="true"
deprecated="not deprecated"
@@ -6487,7 +6465,7 @@
type="int"
transient="false"
volatile="false"
- value="16843586"
+ value="16843584"
static="true"
final="true"
deprecated="not deprecated"
@@ -6641,7 +6619,7 @@
type="int"
transient="false"
volatile="false"
- value="16843585"
+ value="16843583"
static="true"
final="true"
deprecated="not deprecated"
@@ -6795,7 +6773,7 @@
type="int"
transient="false"
volatile="false"
- value="16843582"
+ value="16843580"
static="true"
final="true"
deprecated="not deprecated"
@@ -6927,7 +6905,7 @@
type="int"
transient="false"
volatile="false"
- value="16843552"
+ value="16843550"
static="true"
final="true"
deprecated="not deprecated"
@@ -7323,7 +7301,7 @@
type="int"
transient="false"
volatile="false"
- value="16843522"
+ value="16843520"
static="true"
final="true"
deprecated="not deprecated"
@@ -7477,7 +7455,7 @@
type="int"
transient="false"
volatile="false"
- value="16843547"
+ value="16843545"
static="true"
final="true"
deprecated="not deprecated"
@@ -7642,7 +7620,7 @@
type="int"
transient="false"
volatile="false"
- value="16843610"
+ value="16843608"
static="true"
final="true"
deprecated="not deprecated"
@@ -7961,7 +7939,7 @@
type="int"
transient="false"
volatile="false"
- value="16843560"
+ value="16843558"
static="true"
final="true"
deprecated="not deprecated"
@@ -7972,7 +7950,7 @@
type="int"
transient="false"
volatile="false"
- value="16843561"
+ value="16843559"
static="true"
final="true"
deprecated="not deprecated"
@@ -7983,7 +7961,7 @@
type="int"
transient="false"
volatile="false"
- value="16843562"
+ value="16843560"
static="true"
final="true"
deprecated="not deprecated"
@@ -8082,7 +8060,7 @@
type="int"
transient="false"
volatile="false"
- value="16843558"
+ value="16843556"
static="true"
final="true"
deprecated="not deprecated"
@@ -8093,7 +8071,7 @@
type="int"
transient="false"
volatile="false"
- value="16843559"
+ value="16843557"
static="true"
final="true"
deprecated="not deprecated"
@@ -8445,7 +8423,7 @@
type="int"
transient="false"
volatile="false"
- value="16843570"
+ value="16843568"
static="true"
final="true"
deprecated="not deprecated"
@@ -8478,7 +8456,7 @@
type="int"
transient="false"
volatile="false"
- value="16843536"
+ value="16843534"
static="true"
final="true"
deprecated="not deprecated"
@@ -8489,7 +8467,7 @@
type="int"
transient="false"
volatile="false"
- value="16843593"
+ value="16843591"
static="true"
final="true"
deprecated="not deprecated"
@@ -8500,7 +8478,7 @@
type="int"
transient="false"
volatile="false"
- value="16843588"
+ value="16843586"
static="true"
final="true"
deprecated="not deprecated"
@@ -8643,7 +8621,7 @@
type="int"
transient="false"
volatile="false"
- value="16843563"
+ value="16843561"
static="true"
final="true"
deprecated="not deprecated"
@@ -8665,7 +8643,7 @@
type="int"
transient="false"
volatile="false"
- value="16843584"
+ value="16843582"
static="true"
final="true"
deprecated="not deprecated"
@@ -8676,7 +8654,7 @@
type="int"
transient="false"
volatile="false"
- value="16843587"
+ value="16843585"
static="true"
final="true"
deprecated="not deprecated"
@@ -8742,7 +8720,7 @@
type="int"
transient="false"
volatile="false"
- value="16843596"
+ value="16843594"
static="true"
final="true"
deprecated="not deprecated"
@@ -8797,7 +8775,7 @@
type="int"
transient="false"
volatile="false"
- value="16843507"
+ value="16843505"
static="true"
final="true"
deprecated="not deprecated"
@@ -8819,7 +8797,7 @@
type="int"
transient="false"
volatile="false"
- value="16843597"
+ value="16843595"
static="true"
final="true"
deprecated="not deprecated"
@@ -8830,7 +8808,7 @@
type="int"
transient="false"
volatile="false"
- value="16843505"
+ value="16843503"
static="true"
final="true"
deprecated="not deprecated"
@@ -8929,7 +8907,7 @@
type="int"
transient="false"
volatile="false"
- value="16843549"
+ value="16843547"
static="true"
final="true"
deprecated="not deprecated"
@@ -8940,7 +8918,7 @@
type="int"
transient="false"
volatile="false"
- value="16843520"
+ value="16843518"
static="true"
final="true"
deprecated="not deprecated"
@@ -9072,7 +9050,7 @@
type="int"
transient="false"
volatile="false"
- value="16843599"
+ value="16843597"
static="true"
final="true"
deprecated="not deprecated"
@@ -9127,7 +9105,7 @@
type="int"
transient="false"
volatile="false"
- value="16843571"
+ value="16843569"
static="true"
final="true"
deprecated="not deprecated"
@@ -9193,7 +9171,7 @@
type="int"
transient="false"
volatile="false"
- value="16843515"
+ value="16843513"
static="true"
final="true"
deprecated="not deprecated"
@@ -9578,7 +9556,7 @@
type="int"
transient="false"
volatile="false"
- value="16843523"
+ value="16843521"
static="true"
final="true"
deprecated="not deprecated"
@@ -9655,7 +9633,7 @@
type="int"
transient="false"
volatile="false"
- value="16843524"
+ value="16843522"
static="true"
final="true"
deprecated="not deprecated"
@@ -9699,7 +9677,7 @@
type="int"
transient="false"
volatile="false"
- value="16843528"
+ value="16843526"
static="true"
final="true"
deprecated="not deprecated"
@@ -9721,7 +9699,7 @@
type="int"
transient="false"
volatile="false"
- value="16843601"
+ value="16843599"
static="true"
final="true"
deprecated="not deprecated"
@@ -9765,7 +9743,7 @@
type="int"
transient="false"
volatile="false"
- value="16843602"
+ value="16843600"
static="true"
final="true"
deprecated="not deprecated"
@@ -9908,7 +9886,7 @@
type="int"
transient="false"
volatile="false"
- value="16843543"
+ value="16843541"
static="true"
final="true"
deprecated="not deprecated"
@@ -9919,7 +9897,7 @@
type="int"
transient="false"
volatile="false"
- value="16843542"
+ value="16843540"
static="true"
final="true"
deprecated="not deprecated"
@@ -9941,7 +9919,7 @@
type="int"
transient="false"
volatile="false"
- value="16843544"
+ value="16843542"
static="true"
final="true"
deprecated="not deprecated"
@@ -10172,7 +10150,7 @@
type="int"
transient="false"
volatile="false"
- value="16843514"
+ value="16843512"
static="true"
final="true"
deprecated="not deprecated"
@@ -10326,7 +10304,7 @@
type="int"
transient="false"
volatile="false"
- value="16843554"
+ value="16843552"
static="true"
final="true"
deprecated="not deprecated"
@@ -10337,7 +10315,7 @@
type="int"
transient="false"
volatile="false"
- value="16843555"
+ value="16843553"
static="true"
final="true"
deprecated="not deprecated"
@@ -10348,7 +10326,7 @@
type="int"
transient="false"
volatile="false"
- value="16843556"
+ value="16843554"
static="true"
final="true"
deprecated="not deprecated"
@@ -10359,7 +10337,7 @@
type="int"
transient="false"
volatile="false"
- value="16843557"
+ value="16843555"
static="true"
final="true"
deprecated="not deprecated"
@@ -10403,7 +10381,7 @@
type="int"
transient="false"
volatile="false"
- value="16843590"
+ value="16843588"
static="true"
final="true"
deprecated="not deprecated"
@@ -10436,7 +10414,7 @@
type="int"
transient="false"
volatile="false"
- value="16843538"
+ value="16843536"
static="true"
final="true"
deprecated="not deprecated"
@@ -10579,7 +10557,7 @@
type="int"
transient="false"
volatile="false"
- value="16843574"
+ value="16843572"
static="true"
final="true"
deprecated="not deprecated"
@@ -10799,7 +10777,7 @@
type="int"
transient="false"
volatile="false"
- value="16843594"
+ value="16843592"
static="true"
final="true"
deprecated="not deprecated"
@@ -10810,7 +10788,7 @@
type="int"
transient="false"
volatile="false"
- value="16843591"
+ value="16843589"
static="true"
final="true"
deprecated="not deprecated"
@@ -10821,7 +10799,7 @@
type="int"
transient="false"
volatile="false"
- value="16843592"
+ value="16843590"
static="true"
final="true"
deprecated="not deprecated"
@@ -10942,7 +10920,7 @@
type="int"
transient="false"
volatile="false"
- value="16843545"
+ value="16843543"
static="true"
final="true"
deprecated="not deprecated"
@@ -11030,7 +11008,7 @@
type="int"
transient="false"
volatile="false"
- value="16843608"
+ value="16843606"
static="true"
final="true"
deprecated="not deprecated"
@@ -11041,7 +11019,7 @@
type="int"
transient="false"
volatile="false"
- value="16843609"
+ value="16843607"
static="true"
final="true"
deprecated="not deprecated"
@@ -28602,8 +28580,8 @@
visibility="public"
>
</method>
-<method name="getCancelable"
- return="boolean"
+<method name="getDialog"
+ return="android.app.Dialog"
abstract="false"
native="false"
synchronized="false"
@@ -28613,8 +28591,8 @@
visibility="public"
>
</method>
-<method name="getDialog"
- return="android.app.Dialog"
+<method name="getShowsDialog"
+ return="boolean"
abstract="false"
native="false"
synchronized="false"
@@ -28624,8 +28602,8 @@
visibility="public"
>
</method>
-<method name="getShowsDialog"
- return="boolean"
+<method name="getTheme"
+ return="int"
abstract="false"
native="false"
synchronized="false"
@@ -28635,8 +28613,8 @@
visibility="public"
>
</method>
-<method name="getTheme"
- return="int"
+<method name="isCancelable"
+ return="boolean"
abstract="false"
native="false"
synchronized="false"
@@ -28822,6 +28800,19 @@
<parameter name="request" type="android.app.DownloadManager.Request">
</parameter>
</method>
+<method name="getMaxBytesOverMobile"
+ return="java.lang.Long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
<method name="getMimeTypeForDownloadedFile"
return="java.lang.String"
abstract="false"
@@ -28835,6 +28826,19 @@
<parameter name="id" type="long">
</parameter>
</method>
+<method name="getRecommendedMaxBytesOverMobile"
+ return="java.lang.Long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
<method name="getUriForDownloadedFile"
return="android.net.Uri"
abstract="false"
@@ -30672,8 +30676,8 @@
<parameter name="listener" type="android.app.FragmentManager.OnBackStackChangedListener">
</parameter>
</method>
-<method name="countBackStackEntries"
- return="int"
+<method name="beginTransaction"
+ return="android.app.FragmentTransaction"
abstract="true"
native="false"
synchronized="false"
@@ -30752,7 +30756,7 @@
<parameter name="tag" type="java.lang.String">
</parameter>
</method>
-<method name="getBackStackEntry"
+<method name="getBackStackEntryAt"
return="android.app.FragmentManager.BackStackEntry"
abstract="true"
native="false"
@@ -30765,8 +30769,8 @@
<parameter name="index" type="int">
</parameter>
</method>
-<method name="getFragment"
- return="android.app.Fragment"
+<method name="getBackStackEntryCount"
+ return="int"
abstract="true"
native="false"
synchronized="false"
@@ -30775,13 +30779,9 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="bundle" type="android.os.Bundle">
-</parameter>
-<parameter name="key" type="java.lang.String">
-</parameter>
</method>
-<method name="openTransaction"
- return="android.app.FragmentTransaction"
+<method name="getFragment"
+ return="android.app.Fragment"
abstract="true"
native="false"
synchronized="false"
@@ -30790,6 +30790,10 @@
deprecated="not deprecated"
visibility="public"
>
+<parameter name="bundle" type="android.os.Bundle">
+</parameter>
+<parameter name="key" type="java.lang.String">
+</parameter>
</method>
<method name="popBackStack"
return="void"
@@ -30933,6 +30937,17 @@
visibility="public"
>
</method>
+<method name="getBreadCrumbShortTitleRes"
+ return="int"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getBreadCrumbTitle"
return="java.lang.CharSequence"
abstract="true"
@@ -30944,6 +30959,17 @@
visibility="public"
>
</method>
+<method name="getBreadCrumbTitleRes"
+ return="int"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getId"
return="int"
abstract="true"
@@ -31303,7 +31329,7 @@
visibility="public"
>
</field>
-<field name="TRANSIT_FRAGMENT_NEXT"
+<field name="TRANSIT_FRAGMENT_FADE"
type="int"
transient="false"
volatile="false"
@@ -31325,17 +31351,6 @@
visibility="public"
>
</field>
-<field name="TRANSIT_FRAGMENT_PREV"
- type="int"
- transient="false"
- volatile="false"
- value="8196"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="TRANSIT_NONE"
type="int"
transient="false"
@@ -33061,19 +33076,6 @@
<parameter name="callback" type="android.app.LoaderManager.LoaderCallbacks&lt;D&gt;">
</parameter>
</method>
-<method name="stopLoader"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="deprecated"
- visibility="public"
->
-<parameter name="id" type="int">
-</parameter>
-</method>
</class>
<interface name="LoaderManager.LoaderCallbacks"
abstract="true"
@@ -37816,7 +37818,7 @@
</parameter>
</method>
<method name="getStorageEncryption"
- return="int"
+ return="boolean"
abstract="false"
native="false"
synchronized="false"
@@ -37828,6 +37830,17 @@
<parameter name="admin" type="android.content.ComponentName">
</parameter>
</method>
+<method name="getStorageEncryptionStatus"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="hasGrantedPolicy"
return="boolean"
abstract="false"
@@ -38168,7 +38181,7 @@
type="int"
transient="false"
volatile="false"
- value="3"
+ value="2"
static="true"
final="true"
deprecated="not deprecated"
@@ -38179,7 +38192,7 @@
type="int"
transient="false"
volatile="false"
- value="4"
+ value="3"
static="true"
final="true"
deprecated="not deprecated"
@@ -38197,17 +38210,6 @@
visibility="public"
>
</field>
-<field name="ENCRYPTION_STATUS_REQUESTED"
- type="int"
- transient="false"
- volatile="false"
- value="2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="ENCRYPTION_STATUS_UNSUPPORTED"
type="int"
transient="false"
@@ -43770,7 +43772,7 @@
visibility="public"
>
</method>
-<method name="onCancelled"
+<method name="onCanceled"
return="void"
abstract="false"
native="false"
@@ -43783,31 +43785,31 @@
<parameter name="data" type="D">
</parameter>
</method>
-<method name="onLoadInBackground"
- return="D"
+<method name="onCancelled"
+ return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
- deprecated="not deprecated"
- visibility="protected"
+ deprecated="deprecated"
+ visibility="public"
>
+<parameter name="data" type="D">
+</parameter>
</method>
-<method name="setUpdateThrottle"
- return="void"
+<method name="onLoadInBackground"
+ return="D"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
- visibility="public"
+ visibility="protected"
>
-<parameter name="delayMS" type="long">
-</parameter>
</method>
-<method name="waitForLoader"
+<method name="setUpdateThrottle"
return="void"
abstract="false"
native="false"
@@ -43817,6 +43819,8 @@
deprecated="not deprecated"
visibility="public"
>
+<parameter name="delayMS" type="long">
+</parameter>
</method>
</class>
<class name="BroadcastReceiver"
@@ -44225,8 +44229,6 @@
</parameter>
<parameter name="mimeTypes" type="java.lang.String[]">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="item" type="android.content.ClipData.Item">
</parameter>
</constructor>
@@ -44239,8 +44241,6 @@
>
<parameter name="description" type="android.content.ClipDescription">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="item" type="android.content.ClipData.Item">
</parameter>
</constructor>
@@ -44279,18 +44279,7 @@
visibility="public"
>
</method>
-<method name="getIcon"
- return="android.graphics.Bitmap"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getItem"
+<method name="getItemAt"
return="android.content.ClipData.Item"
abstract="false"
native="false"
@@ -44326,8 +44315,6 @@
>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="intent" type="android.content.Intent">
</parameter>
</method>
@@ -44343,8 +44330,6 @@
>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="text" type="java.lang.CharSequence">
</parameter>
</method>
@@ -44360,8 +44345,6 @@
>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
@@ -44379,8 +44362,6 @@
</parameter>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
@@ -50351,6 +50332,16 @@
>
<parameter name="context" type="android.content.Context">
</parameter>
+</constructor>
+<constructor name="CursorLoader"
+ type="android.content.CursorLoader"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="projection" type="java.lang.String[]">
@@ -50441,7 +50432,7 @@
visibility="public"
>
</method>
-<method name="onCancelled"
+<method name="onCanceled"
return="void"
abstract="false"
native="false"
@@ -57375,145 +57366,6 @@
>
</field>
</class>
-<class name="XmlDocumentProvider"
- extends="android.content.ContentProvider"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="XmlDocumentProvider"
- type="android.content.XmlDocumentProvider"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="delete"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="selection" type="java.lang.String">
-</parameter>
-<parameter name="selectionArgs" type="java.lang.String[]">
-</parameter>
-</method>
-<method name="getResourceXmlPullParser"
- return="org.xmlpull.v1.XmlPullParser"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="protected"
->
-<parameter name="resourceUri" type="android.net.Uri">
-</parameter>
-</method>
-<method name="getType"
- return="java.lang.String"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-</method>
-<method name="getUriXmlPullParser"
- return="org.xmlpull.v1.XmlPullParser"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="protected"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="insert"
- return="android.net.Uri"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="values" type="android.content.ContentValues">
-</parameter>
-</method>
-<method name="onCreate"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="query"
- return="android.database.Cursor"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="projection" type="java.lang.String[]">
-</parameter>
-<parameter name="selection" type="java.lang.String">
-</parameter>
-<parameter name="selectionArgs" type="java.lang.String[]">
-</parameter>
-<parameter name="sortOrder" type="java.lang.String">
-</parameter>
-</method>
-<method name="update"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="values" type="android.content.ContentValues">
-</parameter>
-<parameter name="selection" type="java.lang.String">
-</parameter>
-<parameter name="selectionArgs" type="java.lang.String[]">
-</parameter>
-</method>
-</class>
</package>
<package name="android.content.pm"
>
@@ -57783,17 +57635,6 @@
type="int"
transient="false"
volatile="false"
- value="1024"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="FLAG_IMMERSIVE"
- type="int"
- transient="false"
- volatile="false"
value="512"
static="true"
final="true"
@@ -60287,19 +60128,6 @@
<exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
</exception>
</method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
<method name="getPackagesForUid"
return="java.lang.String[]"
abstract="true"
@@ -60786,21 +60614,6 @@
<parameter name="installerPackageName" type="java.lang.String">
</parameter>
</method>
-<method name="setPackageObbPaths"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
<field name="COMPONENT_ENABLED_STATE_DEFAULT"
type="int"
transient="false"
@@ -61562,6 +61375,46 @@
visibility="public"
>
</field>
+<field name="externalCacheSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="externalDataSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="externalMediaSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="externalObbSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="packageName"
type="java.lang.String"
transient="false"
@@ -77084,6 +76937,16 @@
visibility="public"
>
</field>
+<field name="inMutable"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="inPreferQualityOverSpeed"
type="boolean"
transient="false"
@@ -86319,7 +86182,7 @@
<method name="updateTexImage"
return="void"
abstract="false"
- native="true"
+ native="false"
synchronized="false"
static="false"
final="false"
@@ -95577,6 +95440,17 @@
visibility="public"
>
</field>
+<field name="TOUCHABLE_INSETS_REGION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="TOUCHABLE_INSETS_VISIBLE"
type="int"
transient="false"
@@ -95608,6 +95482,16 @@
visibility="public"
>
</field>
+<field name="touchableRegion"
+ type="android.graphics.Region"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="visibleTopInsets"
type="int"
transient="false"
@@ -147371,53 +147255,6 @@
>
</field>
</class>
-<class name="StorageEventListener"
- extends="java.lang.Object"
- abstract="true"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageEventListener"
- type="android.os.storage.StorageEventListener"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="onStorageStateChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="path" type="java.lang.String">
-</parameter>
-<parameter name="oldState" type="java.lang.String">
-</parameter>
-<parameter name="newState" type="java.lang.String">
-</parameter>
-</method>
-<method name="onUsbMassStorageConnectionChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="connected" type="boolean">
-</parameter>
-</method>
-</class>
<class name="StorageManager"
extends="java.lang.Object"
abstract="false"
@@ -147487,111 +147324,6 @@
</parameter>
</method>
</class>
-<class name="StorageResultCode"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageResultCode"
- type="android.os.storage.StorageResultCode"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<field name="OperationFailedInternalError"
- type="int"
- transient="false"
- volatile="false"
- value="-1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaBlank"
- type="int"
- transient="false"
- volatile="false"
- value="-3"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaCorrupt"
- type="int"
- transient="false"
- volatile="false"
- value="-4"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedNoMedia"
- type="int"
- transient="false"
- volatile="false"
- value="-2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageBusy"
- type="int"
- transient="false"
- volatile="false"
- value="-7"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-6"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageNotMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationSucceeded"
- type="int"
- transient="false"
- volatile="false"
- value="0"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
</package>
<package name="android.preference"
>
@@ -167286,6 +167018,38 @@
<parameter name="dimX" type="int">
</parameter>
</method>
+<method name="setFromFieldPacker"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="xoff" type="int">
+</parameter>
+<parameter name="fp" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
+<method name="setFromFieldPacker"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="xoff" type="int">
+</parameter>
+<parameter name="component_number" type="int">
+</parameter>
+<parameter name="fp" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
<method name="syncAll"
return="void"
abstract="false"
@@ -173046,6 +172810,49 @@
deprecated="not deprecated"
visibility="public"
>
+<method name="bindAllocation"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="va" type="android.renderscript.Allocation">
+</parameter>
+<parameter name="slot" type="int">
+</parameter>
+</method>
+<method name="invoke"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="slot" type="int">
+</parameter>
+</method>
+<method name="invoke"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="slot" type="int">
+</parameter>
+<parameter name="v" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
<method name="setTimeZone"
return="void"
abstract="false"
@@ -173059,6 +172866,111 @@
<parameter name="timeZone" type="java.lang.String">
</parameter>
</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="float">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="double">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="int">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="long">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="boolean">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="o" type="android.renderscript.BaseObj">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
</class>
<class name="Script.Builder"
extends="java.lang.Object"
@@ -173190,6 +173102,32 @@
deprecated="not deprecated"
visibility="public"
>
+<constructor name="ScriptC"
+ type="android.renderscript.ScriptC"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="id" type="int">
+</parameter>
+<parameter name="rs" type="android.renderscript.RenderScript">
+</parameter>
+</constructor>
+<constructor name="ScriptC"
+ type="android.renderscript.ScriptC"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="rs" type="android.renderscript.RenderScript">
+</parameter>
+<parameter name="resources" type="android.content.res.Resources">
+</parameter>
+<parameter name="resourceID" type="int">
+</parameter>
+</constructor>
</class>
<class name="Short2"
extends="java.lang.Object"
@@ -183646,6 +183584,17 @@
visibility="public"
>
</method>
+<method name="getObbDir"
+ return="java.io.File"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getPackageCodePath"
return="java.lang.String"
abstract="false"
@@ -185234,19 +185183,6 @@
<exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
</exception>
</method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
<method name="getPackagesForUid"
return="java.lang.String[]"
abstract="false"
@@ -185731,36 +185667,6 @@
<parameter name="installerPackageName" type="java.lang.String">
</parameter>
</method>
-<method name="setPackageObbPath"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
-<method name="setPackageObbPaths"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
</class>
<class name="MockResources"
extends="android.content.res.Resources"
diff --git a/api/9.xml b/api/9.xml
index 3b9ab1a0edfc..15fcffe71640 100644
--- a/api/9.xml
+++ b/api/9.xml
@@ -157967,21 +157967,6 @@
<parameter name="flags" type="int">
</parameter>
</method>
-<method name="setPackageObbPath"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
</class>
<class name="MockResources"
extends="android.content.res.Resources"
diff --git a/api/current.xml b/api/current.xml
index ef23af2ff000..4f566f6a02e2 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -1790,7 +1790,7 @@
type="int"
transient="false"
volatile="false"
- value="16843501"
+ value="16843499"
static="true"
final="true"
deprecated="not deprecated"
@@ -1812,7 +1812,7 @@
type="int"
transient="false"
volatile="false"
- value="16843510"
+ value="16843508"
static="true"
final="true"
deprecated="not deprecated"
@@ -1823,7 +1823,7 @@
type="int"
transient="false"
volatile="false"
- value="16843509"
+ value="16843507"
static="true"
final="true"
deprecated="not deprecated"
@@ -1834,7 +1834,7 @@
type="int"
transient="false"
volatile="false"
- value="16843511"
+ value="16843509"
static="true"
final="true"
deprecated="not deprecated"
@@ -1867,7 +1867,7 @@
type="int"
transient="false"
volatile="false"
- value="16843517"
+ value="16843515"
static="true"
final="true"
deprecated="not deprecated"
@@ -1889,7 +1889,7 @@
type="int"
transient="false"
volatile="false"
- value="16843513"
+ value="16843511"
static="true"
final="true"
deprecated="not deprecated"
@@ -1911,7 +1911,7 @@
type="int"
transient="false"
volatile="false"
- value="16843540"
+ value="16843538"
static="true"
final="true"
deprecated="not deprecated"
@@ -1922,7 +1922,7 @@
type="int"
transient="false"
volatile="false"
- value="16843539"
+ value="16843537"
static="true"
final="true"
deprecated="not deprecated"
@@ -1933,7 +1933,7 @@
type="int"
transient="false"
volatile="false"
- value="16843541"
+ value="16843539"
static="true"
final="true"
deprecated="not deprecated"
@@ -1944,7 +1944,7 @@
type="int"
transient="false"
volatile="false"
- value="16843512"
+ value="16843510"
static="true"
final="true"
deprecated="not deprecated"
@@ -1955,7 +1955,7 @@
type="int"
transient="false"
volatile="false"
- value="16843518"
+ value="16843516"
static="true"
final="true"
deprecated="not deprecated"
@@ -1966,7 +1966,7 @@
type="int"
transient="false"
volatile="false"
- value="16843519"
+ value="16843517"
static="true"
final="true"
deprecated="not deprecated"
@@ -2043,7 +2043,7 @@
type="int"
transient="false"
volatile="false"
- value="16843607"
+ value="16843605"
static="true"
final="true"
deprecated="not deprecated"
@@ -2065,7 +2065,7 @@
type="int"
transient="false"
volatile="false"
- value="16843531"
+ value="16843529"
static="true"
final="true"
deprecated="not deprecated"
@@ -2109,7 +2109,7 @@
type="int"
transient="false"
volatile="false"
- value="16843572"
+ value="16843570"
static="true"
final="true"
deprecated="not deprecated"
@@ -2142,7 +2142,7 @@
type="int"
transient="false"
volatile="false"
- value="16843553"
+ value="16843551"
static="true"
final="true"
deprecated="not deprecated"
@@ -2208,7 +2208,7 @@
type="int"
transient="false"
volatile="false"
- value="16843508"
+ value="16843506"
static="true"
final="true"
deprecated="not deprecated"
@@ -2274,7 +2274,7 @@
type="int"
transient="false"
volatile="false"
- value="16843548"
+ value="16843546"
static="true"
final="true"
deprecated="not deprecated"
@@ -2340,7 +2340,7 @@
type="int"
transient="false"
volatile="false"
- value="16843537"
+ value="16843535"
static="true"
final="true"
deprecated="not deprecated"
@@ -2450,7 +2450,7 @@
type="int"
transient="false"
volatile="false"
- value="16843550"
+ value="16843548"
static="true"
final="true"
deprecated="not deprecated"
@@ -2494,7 +2494,7 @@
type="int"
transient="false"
volatile="false"
- value="16843565"
+ value="16843563"
static="true"
final="true"
deprecated="not deprecated"
@@ -2582,7 +2582,7 @@
type="int"
transient="false"
volatile="false"
- value="16843526"
+ value="16843524"
static="true"
final="true"
deprecated="not deprecated"
@@ -2593,7 +2593,7 @@
type="int"
transient="false"
volatile="false"
- value="16843525"
+ value="16843523"
static="true"
final="true"
deprecated="not deprecated"
@@ -2626,7 +2626,7 @@
type="int"
transient="false"
volatile="false"
- value="16843569"
+ value="16843567"
static="true"
final="true"
deprecated="not deprecated"
@@ -2637,7 +2637,7 @@
type="int"
transient="false"
volatile="false"
- value="16843568"
+ value="16843566"
static="true"
final="true"
deprecated="not deprecated"
@@ -2703,7 +2703,7 @@
type="int"
transient="false"
volatile="false"
- value="16843598"
+ value="16843596"
static="true"
final="true"
deprecated="not deprecated"
@@ -3220,7 +3220,7 @@
type="int"
transient="false"
volatile="false"
- value="16843581"
+ value="16843579"
static="true"
final="true"
deprecated="not deprecated"
@@ -3275,7 +3275,7 @@
type="int"
transient="false"
volatile="false"
- value="16843595"
+ value="16843593"
static="true"
final="true"
deprecated="not deprecated"
@@ -3385,7 +3385,7 @@
type="int"
transient="false"
volatile="false"
- value="16843600"
+ value="16843598"
static="true"
final="true"
deprecated="not deprecated"
@@ -3451,7 +3451,7 @@
type="int"
transient="false"
volatile="false"
- value="16843530"
+ value="16843528"
static="true"
final="true"
deprecated="not deprecated"
@@ -3572,7 +3572,7 @@
type="int"
transient="false"
volatile="false"
- value="16843566"
+ value="16843564"
static="true"
final="true"
deprecated="not deprecated"
@@ -3583,7 +3583,7 @@
type="int"
transient="false"
volatile="false"
- value="16843564"
+ value="16843562"
static="true"
final="true"
deprecated="not deprecated"
@@ -3594,7 +3594,7 @@
type="int"
transient="false"
volatile="false"
- value="16843532"
+ value="16843530"
static="true"
final="true"
deprecated="not deprecated"
@@ -3825,7 +3825,7 @@
type="int"
transient="false"
volatile="false"
- value="16843604"
+ value="16843602"
static="true"
final="true"
deprecated="not deprecated"
@@ -3836,7 +3836,7 @@
type="int"
transient="false"
volatile="false"
- value="16843603"
+ value="16843601"
static="true"
final="true"
deprecated="not deprecated"
@@ -3946,7 +3946,7 @@
type="int"
transient="false"
volatile="false"
- value="16843534"
+ value="16843532"
static="true"
final="true"
deprecated="not deprecated"
@@ -4001,7 +4001,7 @@
type="int"
transient="false"
volatile="false"
- value="16843535"
+ value="16843533"
static="true"
final="true"
deprecated="not deprecated"
@@ -4199,7 +4199,7 @@
type="int"
transient="false"
volatile="false"
- value="16843575"
+ value="16843573"
static="true"
final="true"
deprecated="not deprecated"
@@ -4221,7 +4221,7 @@
type="int"
transient="false"
volatile="false"
- value="16843580"
+ value="16843578"
static="true"
final="true"
deprecated="not deprecated"
@@ -4232,7 +4232,7 @@
type="int"
transient="false"
volatile="false"
- value="16843577"
+ value="16843575"
static="true"
final="true"
deprecated="not deprecated"
@@ -4243,7 +4243,7 @@
type="int"
transient="false"
volatile="false"
- value="16843578"
+ value="16843576"
static="true"
final="true"
deprecated="not deprecated"
@@ -4254,7 +4254,7 @@
type="int"
transient="false"
volatile="false"
- value="16843611"
+ value="16843609"
static="true"
final="true"
deprecated="not deprecated"
@@ -4265,7 +4265,7 @@
type="int"
transient="false"
volatile="false"
- value="16843576"
+ value="16843574"
static="true"
final="true"
deprecated="not deprecated"
@@ -4276,7 +4276,7 @@
type="int"
transient="false"
volatile="false"
- value="16843579"
+ value="16843577"
static="true"
final="true"
deprecated="not deprecated"
@@ -4375,7 +4375,7 @@
type="int"
transient="false"
volatile="false"
- value="16843583"
+ value="16843581"
static="true"
final="true"
deprecated="not deprecated"
@@ -4430,7 +4430,7 @@
type="int"
transient="false"
volatile="false"
- value="16843589"
+ value="16843587"
static="true"
final="true"
deprecated="not deprecated"
@@ -4514,7 +4514,7 @@
visibility="public"
>
</field>
-<field name="fragmentNextEnterAnimation"
+<field name="fragmentFadeEnterAnimation"
type="int"
transient="false"
volatile="false"
@@ -4525,7 +4525,7 @@
visibility="public"
>
</field>
-<field name="fragmentNextExitAnimation"
+<field name="fragmentFadeExitAnimation"
type="int"
transient="false"
volatile="false"
@@ -4558,28 +4558,6 @@
visibility="public"
>
</field>
-<field name="fragmentPrevEnterAnimation"
- type="int"
- transient="false"
- volatile="false"
- value="16843499"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="fragmentPrevExitAnimation"
- type="int"
- transient="false"
- volatile="false"
- value="16843500"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="freezesText"
type="int"
transient="false"
@@ -4969,7 +4947,7 @@
type="int"
transient="false"
volatile="false"
- value="16843533"
+ value="16843531"
static="true"
final="true"
deprecated="not deprecated"
@@ -4980,7 +4958,7 @@
type="int"
transient="false"
volatile="false"
- value="16843551"
+ value="16843549"
static="true"
final="true"
deprecated="not deprecated"
@@ -5013,7 +4991,7 @@
type="int"
transient="false"
volatile="false"
- value="16843605"
+ value="16843603"
static="true"
final="true"
deprecated="not deprecated"
@@ -5068,7 +5046,7 @@
type="int"
transient="false"
volatile="false"
- value="16843516"
+ value="16843514"
static="true"
final="true"
deprecated="not deprecated"
@@ -5189,7 +5167,7 @@
type="int"
transient="false"
volatile="false"
- value="16843504"
+ value="16843502"
static="true"
final="true"
deprecated="not deprecated"
@@ -5200,7 +5178,7 @@
type="int"
transient="false"
volatile="false"
- value="16843502"
+ value="16843500"
static="true"
final="true"
deprecated="not deprecated"
@@ -5211,7 +5189,7 @@
type="int"
transient="false"
volatile="false"
- value="16843503"
+ value="16843501"
static="true"
final="true"
deprecated="not deprecated"
@@ -5321,7 +5299,7 @@
type="int"
transient="false"
volatile="false"
- value="16843546"
+ value="16843544"
static="true"
final="true"
deprecated="not deprecated"
@@ -5497,7 +5475,7 @@
type="int"
transient="false"
volatile="false"
- value="16843573"
+ value="16843571"
static="true"
final="true"
deprecated="not deprecated"
@@ -5596,7 +5574,7 @@
type="int"
transient="false"
volatile="false"
- value="16843567"
+ value="16843565"
static="true"
final="true"
deprecated="not deprecated"
@@ -5827,7 +5805,7 @@
type="int"
transient="false"
volatile="false"
- value="16843612"
+ value="16843610"
static="true"
final="true"
deprecated="not deprecated"
@@ -5860,7 +5838,7 @@
type="int"
transient="false"
volatile="false"
- value="16843606"
+ value="16843604"
static="true"
final="true"
deprecated="not deprecated"
@@ -6289,7 +6267,7 @@
type="int"
transient="false"
volatile="false"
- value="16843506"
+ value="16843504"
static="true"
final="true"
deprecated="not deprecated"
@@ -6333,7 +6311,7 @@
type="int"
transient="false"
volatile="false"
- value="16843527"
+ value="16843525"
static="true"
final="true"
deprecated="not deprecated"
@@ -6344,7 +6322,7 @@
type="int"
transient="false"
volatile="false"
- value="16843521"
+ value="16843519"
static="true"
final="true"
deprecated="not deprecated"
@@ -6432,7 +6410,7 @@
type="int"
transient="false"
volatile="false"
- value="16843529"
+ value="16843527"
static="true"
final="true"
deprecated="not deprecated"
@@ -6487,7 +6465,7 @@
type="int"
transient="false"
volatile="false"
- value="16843586"
+ value="16843584"
static="true"
final="true"
deprecated="not deprecated"
@@ -6641,7 +6619,7 @@
type="int"
transient="false"
volatile="false"
- value="16843585"
+ value="16843583"
static="true"
final="true"
deprecated="not deprecated"
@@ -6795,7 +6773,7 @@
type="int"
transient="false"
volatile="false"
- value="16843582"
+ value="16843580"
static="true"
final="true"
deprecated="not deprecated"
@@ -6927,7 +6905,7 @@
type="int"
transient="false"
volatile="false"
- value="16843552"
+ value="16843550"
static="true"
final="true"
deprecated="not deprecated"
@@ -7323,7 +7301,7 @@
type="int"
transient="false"
volatile="false"
- value="16843522"
+ value="16843520"
static="true"
final="true"
deprecated="not deprecated"
@@ -7477,7 +7455,7 @@
type="int"
transient="false"
volatile="false"
- value="16843547"
+ value="16843545"
static="true"
final="true"
deprecated="not deprecated"
@@ -7642,7 +7620,7 @@
type="int"
transient="false"
volatile="false"
- value="16843610"
+ value="16843608"
static="true"
final="true"
deprecated="not deprecated"
@@ -7961,7 +7939,7 @@
type="int"
transient="false"
volatile="false"
- value="16843560"
+ value="16843558"
static="true"
final="true"
deprecated="not deprecated"
@@ -7972,7 +7950,7 @@
type="int"
transient="false"
volatile="false"
- value="16843561"
+ value="16843559"
static="true"
final="true"
deprecated="not deprecated"
@@ -7983,7 +7961,7 @@
type="int"
transient="false"
volatile="false"
- value="16843562"
+ value="16843560"
static="true"
final="true"
deprecated="not deprecated"
@@ -8082,7 +8060,7 @@
type="int"
transient="false"
volatile="false"
- value="16843558"
+ value="16843556"
static="true"
final="true"
deprecated="not deprecated"
@@ -8093,7 +8071,7 @@
type="int"
transient="false"
volatile="false"
- value="16843559"
+ value="16843557"
static="true"
final="true"
deprecated="not deprecated"
@@ -8445,7 +8423,7 @@
type="int"
transient="false"
volatile="false"
- value="16843570"
+ value="16843568"
static="true"
final="true"
deprecated="not deprecated"
@@ -8478,7 +8456,7 @@
type="int"
transient="false"
volatile="false"
- value="16843536"
+ value="16843534"
static="true"
final="true"
deprecated="not deprecated"
@@ -8489,7 +8467,7 @@
type="int"
transient="false"
volatile="false"
- value="16843593"
+ value="16843591"
static="true"
final="true"
deprecated="not deprecated"
@@ -8500,7 +8478,7 @@
type="int"
transient="false"
volatile="false"
- value="16843588"
+ value="16843586"
static="true"
final="true"
deprecated="not deprecated"
@@ -8643,7 +8621,7 @@
type="int"
transient="false"
volatile="false"
- value="16843563"
+ value="16843561"
static="true"
final="true"
deprecated="not deprecated"
@@ -8665,7 +8643,7 @@
type="int"
transient="false"
volatile="false"
- value="16843584"
+ value="16843582"
static="true"
final="true"
deprecated="not deprecated"
@@ -8676,7 +8654,7 @@
type="int"
transient="false"
volatile="false"
- value="16843587"
+ value="16843585"
static="true"
final="true"
deprecated="not deprecated"
@@ -8742,7 +8720,7 @@
type="int"
transient="false"
volatile="false"
- value="16843596"
+ value="16843594"
static="true"
final="true"
deprecated="not deprecated"
@@ -8797,7 +8775,7 @@
type="int"
transient="false"
volatile="false"
- value="16843507"
+ value="16843505"
static="true"
final="true"
deprecated="not deprecated"
@@ -8819,7 +8797,7 @@
type="int"
transient="false"
volatile="false"
- value="16843597"
+ value="16843595"
static="true"
final="true"
deprecated="not deprecated"
@@ -8830,7 +8808,7 @@
type="int"
transient="false"
volatile="false"
- value="16843505"
+ value="16843503"
static="true"
final="true"
deprecated="not deprecated"
@@ -8929,7 +8907,7 @@
type="int"
transient="false"
volatile="false"
- value="16843549"
+ value="16843547"
static="true"
final="true"
deprecated="not deprecated"
@@ -8940,7 +8918,7 @@
type="int"
transient="false"
volatile="false"
- value="16843520"
+ value="16843518"
static="true"
final="true"
deprecated="not deprecated"
@@ -9072,7 +9050,7 @@
type="int"
transient="false"
volatile="false"
- value="16843599"
+ value="16843597"
static="true"
final="true"
deprecated="not deprecated"
@@ -9127,7 +9105,7 @@
type="int"
transient="false"
volatile="false"
- value="16843571"
+ value="16843569"
static="true"
final="true"
deprecated="not deprecated"
@@ -9193,7 +9171,7 @@
type="int"
transient="false"
volatile="false"
- value="16843515"
+ value="16843513"
static="true"
final="true"
deprecated="not deprecated"
@@ -9578,7 +9556,7 @@
type="int"
transient="false"
volatile="false"
- value="16843523"
+ value="16843521"
static="true"
final="true"
deprecated="not deprecated"
@@ -9655,7 +9633,7 @@
type="int"
transient="false"
volatile="false"
- value="16843524"
+ value="16843522"
static="true"
final="true"
deprecated="not deprecated"
@@ -9699,7 +9677,7 @@
type="int"
transient="false"
volatile="false"
- value="16843528"
+ value="16843526"
static="true"
final="true"
deprecated="not deprecated"
@@ -9721,7 +9699,7 @@
type="int"
transient="false"
volatile="false"
- value="16843601"
+ value="16843599"
static="true"
final="true"
deprecated="not deprecated"
@@ -9765,7 +9743,7 @@
type="int"
transient="false"
volatile="false"
- value="16843602"
+ value="16843600"
static="true"
final="true"
deprecated="not deprecated"
@@ -9908,7 +9886,7 @@
type="int"
transient="false"
volatile="false"
- value="16843543"
+ value="16843541"
static="true"
final="true"
deprecated="not deprecated"
@@ -9919,7 +9897,7 @@
type="int"
transient="false"
volatile="false"
- value="16843542"
+ value="16843540"
static="true"
final="true"
deprecated="not deprecated"
@@ -9941,7 +9919,7 @@
type="int"
transient="false"
volatile="false"
- value="16843544"
+ value="16843542"
static="true"
final="true"
deprecated="not deprecated"
@@ -10172,7 +10150,7 @@
type="int"
transient="false"
volatile="false"
- value="16843514"
+ value="16843512"
static="true"
final="true"
deprecated="not deprecated"
@@ -10326,7 +10304,7 @@
type="int"
transient="false"
volatile="false"
- value="16843554"
+ value="16843552"
static="true"
final="true"
deprecated="not deprecated"
@@ -10337,7 +10315,7 @@
type="int"
transient="false"
volatile="false"
- value="16843555"
+ value="16843553"
static="true"
final="true"
deprecated="not deprecated"
@@ -10348,7 +10326,7 @@
type="int"
transient="false"
volatile="false"
- value="16843556"
+ value="16843554"
static="true"
final="true"
deprecated="not deprecated"
@@ -10359,7 +10337,7 @@
type="int"
transient="false"
volatile="false"
- value="16843557"
+ value="16843555"
static="true"
final="true"
deprecated="not deprecated"
@@ -10403,7 +10381,7 @@
type="int"
transient="false"
volatile="false"
- value="16843590"
+ value="16843588"
static="true"
final="true"
deprecated="not deprecated"
@@ -10436,7 +10414,7 @@
type="int"
transient="false"
volatile="false"
- value="16843538"
+ value="16843536"
static="true"
final="true"
deprecated="not deprecated"
@@ -10579,7 +10557,7 @@
type="int"
transient="false"
volatile="false"
- value="16843574"
+ value="16843572"
static="true"
final="true"
deprecated="not deprecated"
@@ -10799,7 +10777,7 @@
type="int"
transient="false"
volatile="false"
- value="16843594"
+ value="16843592"
static="true"
final="true"
deprecated="not deprecated"
@@ -10810,7 +10788,7 @@
type="int"
transient="false"
volatile="false"
- value="16843591"
+ value="16843589"
static="true"
final="true"
deprecated="not deprecated"
@@ -10821,7 +10799,7 @@
type="int"
transient="false"
volatile="false"
- value="16843592"
+ value="16843590"
static="true"
final="true"
deprecated="not deprecated"
@@ -10942,7 +10920,7 @@
type="int"
transient="false"
volatile="false"
- value="16843545"
+ value="16843543"
static="true"
final="true"
deprecated="not deprecated"
@@ -11030,7 +11008,7 @@
type="int"
transient="false"
volatile="false"
- value="16843608"
+ value="16843606"
static="true"
final="true"
deprecated="not deprecated"
@@ -11041,7 +11019,7 @@
type="int"
transient="false"
volatile="false"
- value="16843609"
+ value="16843607"
static="true"
final="true"
deprecated="not deprecated"
@@ -28602,8 +28580,8 @@
visibility="public"
>
</method>
-<method name="getCancelable"
- return="boolean"
+<method name="getDialog"
+ return="android.app.Dialog"
abstract="false"
native="false"
synchronized="false"
@@ -28613,8 +28591,8 @@
visibility="public"
>
</method>
-<method name="getDialog"
- return="android.app.Dialog"
+<method name="getShowsDialog"
+ return="boolean"
abstract="false"
native="false"
synchronized="false"
@@ -28624,8 +28602,8 @@
visibility="public"
>
</method>
-<method name="getShowsDialog"
- return="boolean"
+<method name="getTheme"
+ return="int"
abstract="false"
native="false"
synchronized="false"
@@ -28635,8 +28613,8 @@
visibility="public"
>
</method>
-<method name="getTheme"
- return="int"
+<method name="isCancelable"
+ return="boolean"
abstract="false"
native="false"
synchronized="false"
@@ -28822,6 +28800,19 @@
<parameter name="request" type="android.app.DownloadManager.Request">
</parameter>
</method>
+<method name="getMaxBytesOverMobile"
+ return="java.lang.Long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
<method name="getMimeTypeForDownloadedFile"
return="java.lang.String"
abstract="false"
@@ -28835,6 +28826,19 @@
<parameter name="id" type="long">
</parameter>
</method>
+<method name="getRecommendedMaxBytesOverMobile"
+ return="java.lang.Long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
<method name="getUriForDownloadedFile"
return="android.net.Uri"
abstract="false"
@@ -30672,8 +30676,8 @@
<parameter name="listener" type="android.app.FragmentManager.OnBackStackChangedListener">
</parameter>
</method>
-<method name="countBackStackEntries"
- return="int"
+<method name="beginTransaction"
+ return="android.app.FragmentTransaction"
abstract="true"
native="false"
synchronized="false"
@@ -30752,7 +30756,7 @@
<parameter name="tag" type="java.lang.String">
</parameter>
</method>
-<method name="getBackStackEntry"
+<method name="getBackStackEntryAt"
return="android.app.FragmentManager.BackStackEntry"
abstract="true"
native="false"
@@ -30765,8 +30769,8 @@
<parameter name="index" type="int">
</parameter>
</method>
-<method name="getFragment"
- return="android.app.Fragment"
+<method name="getBackStackEntryCount"
+ return="int"
abstract="true"
native="false"
synchronized="false"
@@ -30775,13 +30779,9 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="bundle" type="android.os.Bundle">
-</parameter>
-<parameter name="key" type="java.lang.String">
-</parameter>
</method>
-<method name="openTransaction"
- return="android.app.FragmentTransaction"
+<method name="getFragment"
+ return="android.app.Fragment"
abstract="true"
native="false"
synchronized="false"
@@ -30790,6 +30790,10 @@
deprecated="not deprecated"
visibility="public"
>
+<parameter name="bundle" type="android.os.Bundle">
+</parameter>
+<parameter name="key" type="java.lang.String">
+</parameter>
</method>
<method name="popBackStack"
return="void"
@@ -30933,6 +30937,17 @@
visibility="public"
>
</method>
+<method name="getBreadCrumbShortTitleRes"
+ return="int"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getBreadCrumbTitle"
return="java.lang.CharSequence"
abstract="true"
@@ -30944,6 +30959,17 @@
visibility="public"
>
</method>
+<method name="getBreadCrumbTitleRes"
+ return="int"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getId"
return="int"
abstract="true"
@@ -31303,7 +31329,7 @@
visibility="public"
>
</field>
-<field name="TRANSIT_FRAGMENT_NEXT"
+<field name="TRANSIT_FRAGMENT_FADE"
type="int"
transient="false"
volatile="false"
@@ -31325,17 +31351,6 @@
visibility="public"
>
</field>
-<field name="TRANSIT_FRAGMENT_PREV"
- type="int"
- transient="false"
- volatile="false"
- value="8196"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="TRANSIT_NONE"
type="int"
transient="false"
@@ -33061,19 +33076,6 @@
<parameter name="callback" type="android.app.LoaderManager.LoaderCallbacks&lt;D&gt;">
</parameter>
</method>
-<method name="stopLoader"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="deprecated"
- visibility="public"
->
-<parameter name="id" type="int">
-</parameter>
-</method>
</class>
<interface name="LoaderManager.LoaderCallbacks"
abstract="true"
@@ -37816,7 +37818,7 @@
</parameter>
</method>
<method name="getStorageEncryption"
- return="int"
+ return="boolean"
abstract="false"
native="false"
synchronized="false"
@@ -37828,6 +37830,17 @@
<parameter name="admin" type="android.content.ComponentName">
</parameter>
</method>
+<method name="getStorageEncryptionStatus"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="hasGrantedPolicy"
return="boolean"
abstract="false"
@@ -38168,7 +38181,7 @@
type="int"
transient="false"
volatile="false"
- value="3"
+ value="2"
static="true"
final="true"
deprecated="not deprecated"
@@ -38179,7 +38192,7 @@
type="int"
transient="false"
volatile="false"
- value="4"
+ value="3"
static="true"
final="true"
deprecated="not deprecated"
@@ -38197,17 +38210,6 @@
visibility="public"
>
</field>
-<field name="ENCRYPTION_STATUS_REQUESTED"
- type="int"
- transient="false"
- volatile="false"
- value="2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="ENCRYPTION_STATUS_UNSUPPORTED"
type="int"
transient="false"
@@ -43770,7 +43772,7 @@
visibility="public"
>
</method>
-<method name="onCancelled"
+<method name="onCanceled"
return="void"
abstract="false"
native="false"
@@ -43783,31 +43785,31 @@
<parameter name="data" type="D">
</parameter>
</method>
-<method name="onLoadInBackground"
- return="D"
+<method name="onCancelled"
+ return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
- deprecated="not deprecated"
- visibility="protected"
+ deprecated="deprecated"
+ visibility="public"
>
+<parameter name="data" type="D">
+</parameter>
</method>
-<method name="setUpdateThrottle"
- return="void"
+<method name="onLoadInBackground"
+ return="D"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
- visibility="public"
+ visibility="protected"
>
-<parameter name="delayMS" type="long">
-</parameter>
</method>
-<method name="waitForLoader"
+<method name="setUpdateThrottle"
return="void"
abstract="false"
native="false"
@@ -43817,6 +43819,8 @@
deprecated="not deprecated"
visibility="public"
>
+<parameter name="delayMS" type="long">
+</parameter>
</method>
</class>
<class name="BroadcastReceiver"
@@ -44225,8 +44229,6 @@
</parameter>
<parameter name="mimeTypes" type="java.lang.String[]">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="item" type="android.content.ClipData.Item">
</parameter>
</constructor>
@@ -44239,8 +44241,6 @@
>
<parameter name="description" type="android.content.ClipDescription">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="item" type="android.content.ClipData.Item">
</parameter>
</constructor>
@@ -44279,18 +44279,7 @@
visibility="public"
>
</method>
-<method name="getIcon"
- return="android.graphics.Bitmap"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getItem"
+<method name="getItemAt"
return="android.content.ClipData.Item"
abstract="false"
native="false"
@@ -44326,8 +44315,6 @@
>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="intent" type="android.content.Intent">
</parameter>
</method>
@@ -44343,8 +44330,6 @@
>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="text" type="java.lang.CharSequence">
</parameter>
</method>
@@ -44360,8 +44345,6 @@
>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
@@ -44379,8 +44362,6 @@
</parameter>
<parameter name="label" type="java.lang.CharSequence">
</parameter>
-<parameter name="icon" type="android.graphics.Bitmap">
-</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
@@ -50351,6 +50332,16 @@
>
<parameter name="context" type="android.content.Context">
</parameter>
+</constructor>
+<constructor name="CursorLoader"
+ type="android.content.CursorLoader"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="projection" type="java.lang.String[]">
@@ -50441,7 +50432,7 @@
visibility="public"
>
</method>
-<method name="onCancelled"
+<method name="onCanceled"
return="void"
abstract="false"
native="false"
@@ -57375,145 +57366,6 @@
>
</field>
</class>
-<class name="XmlDocumentProvider"
- extends="android.content.ContentProvider"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="XmlDocumentProvider"
- type="android.content.XmlDocumentProvider"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="delete"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="selection" type="java.lang.String">
-</parameter>
-<parameter name="selectionArgs" type="java.lang.String[]">
-</parameter>
-</method>
-<method name="getResourceXmlPullParser"
- return="org.xmlpull.v1.XmlPullParser"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="protected"
->
-<parameter name="resourceUri" type="android.net.Uri">
-</parameter>
-</method>
-<method name="getType"
- return="java.lang.String"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-</method>
-<method name="getUriXmlPullParser"
- return="org.xmlpull.v1.XmlPullParser"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="protected"
->
-<parameter name="url" type="java.lang.String">
-</parameter>
-</method>
-<method name="insert"
- return="android.net.Uri"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="values" type="android.content.ContentValues">
-</parameter>
-</method>
-<method name="onCreate"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="query"
- return="android.database.Cursor"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="projection" type="java.lang.String[]">
-</parameter>
-<parameter name="selection" type="java.lang.String">
-</parameter>
-<parameter name="selectionArgs" type="java.lang.String[]">
-</parameter>
-<parameter name="sortOrder" type="java.lang.String">
-</parameter>
-</method>
-<method name="update"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="uri" type="android.net.Uri">
-</parameter>
-<parameter name="values" type="android.content.ContentValues">
-</parameter>
-<parameter name="selection" type="java.lang.String">
-</parameter>
-<parameter name="selectionArgs" type="java.lang.String[]">
-</parameter>
-</method>
-</class>
</package>
<package name="android.content.pm"
>
@@ -57783,17 +57635,6 @@
type="int"
transient="false"
volatile="false"
- value="1024"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="FLAG_IMMERSIVE"
- type="int"
- transient="false"
- volatile="false"
value="512"
static="true"
final="true"
@@ -60287,19 +60128,6 @@
<exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
</exception>
</method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
<method name="getPackagesForUid"
return="java.lang.String[]"
abstract="true"
@@ -60786,21 +60614,6 @@
<parameter name="installerPackageName" type="java.lang.String">
</parameter>
</method>
-<method name="setPackageObbPaths"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
<field name="COMPONENT_ENABLED_STATE_DEFAULT"
type="int"
transient="false"
@@ -61592,6 +61405,16 @@
visibility="public"
>
</field>
+<field name="externalObbSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="packageName"
type="java.lang.String"
transient="false"
@@ -77114,6 +76937,16 @@
visibility="public"
>
</field>
+<field name="inMutable"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="inPreferQualityOverSpeed"
type="boolean"
transient="false"
@@ -86349,7 +86182,7 @@
<method name="updateTexImage"
return="void"
abstract="false"
- native="true"
+ native="false"
synchronized="false"
static="false"
final="false"
@@ -146858,6 +146691,16 @@
visibility="public"
>
</constructor>
+<constructor name="StrictMode.VmPolicy.Builder"
+ type="android.os.StrictMode.VmPolicy.Builder"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="base" type="android.os.StrictMode.VmPolicy">
+</parameter>
+</constructor>
<method name="build"
return="android.os.StrictMode.VmPolicy"
abstract="false"
@@ -146935,6 +146778,21 @@
visibility="public"
>
</method>
+<method name="setClassInstanceLimit"
+ return="android.os.StrictMode.VmPolicy.Builder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="klass" type="java.lang.Class">
+</parameter>
+<parameter name="instanceLimit" type="int">
+</parameter>
+</method>
</class>
<class name="SystemClock"
extends="java.lang.Object"
@@ -147422,53 +147280,6 @@
>
</field>
</class>
-<class name="StorageEventListener"
- extends="java.lang.Object"
- abstract="true"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageEventListener"
- type="android.os.storage.StorageEventListener"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="onStorageStateChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="path" type="java.lang.String">
-</parameter>
-<parameter name="oldState" type="java.lang.String">
-</parameter>
-<parameter name="newState" type="java.lang.String">
-</parameter>
-</method>
-<method name="onUsbMassStorageConnectionChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="connected" type="boolean">
-</parameter>
-</method>
-</class>
<class name="StorageManager"
extends="java.lang.Object"
abstract="false"
@@ -147538,111 +147349,6 @@
</parameter>
</method>
</class>
-<class name="StorageResultCode"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageResultCode"
- type="android.os.storage.StorageResultCode"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<field name="OperationFailedInternalError"
- type="int"
- transient="false"
- volatile="false"
- value="-1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaBlank"
- type="int"
- transient="false"
- volatile="false"
- value="-3"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaCorrupt"
- type="int"
- transient="false"
- volatile="false"
- value="-4"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedNoMedia"
- type="int"
- transient="false"
- volatile="false"
- value="-2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageBusy"
- type="int"
- transient="false"
- volatile="false"
- value="-7"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-6"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageNotMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationSucceeded"
- type="int"
- transient="false"
- volatile="false"
- value="0"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
</package>
<package name="android.preference"
>
@@ -183903,6 +183609,17 @@
visibility="public"
>
</method>
+<method name="getObbDir"
+ return="java.io.File"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getPackageCodePath"
return="java.lang.String"
abstract="false"
@@ -185491,19 +185208,6 @@
<exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
</exception>
</method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
<method name="getPackagesForUid"
return="java.lang.String[]"
abstract="false"
@@ -185988,36 +185692,6 @@
<parameter name="installerPackageName" type="java.lang.String">
</parameter>
</method>
-<method name="setPackageObbPath"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
-<method name="setPackageObbPaths"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
</class>
<class name="MockResources"
extends="android.content.res.Resources"
@@ -236386,6 +236060,48 @@
</parameter>
</method>
</class>
+<class name="WebStorage.Origin"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="getOrigin"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getQuota"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getUsage"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
<interface name="WebStorage.QuotaUpdater"
abstract="true"
static="true"
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index ec2f771cd984..93ad17e763a6 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -45,6 +45,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Parcelable;
import android.os.RemoteException;
+import android.os.StrictMode;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -858,6 +859,7 @@ public class Activity extends ContextThemeWrapper
mFragments.restoreAllState(p, mLastNonConfigurationInstances != null
? mLastNonConfigurationInstances.fragments : null);
}
+ StrictMode.noteActivityClass(this.getClass());
mFragments.dispatchCreate();
mCalled = true;
}
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index b64069d9ff71..079d4cfd0c82 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1103,25 +1103,6 @@ final class ApplicationPackageManager extends PackageManager {
return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
}
- @Override
- public void setPackageObbPaths(String packageName, String[] paths) {
- try {
- mPM.setPackageObbPaths(packageName, paths);
- } catch (RemoteException e) {
- // Should never happen!
- }
- }
-
- @Override
- public String[] getPackageObbPaths(String packageName) {
- try {
- return mPM.getPackageObbPaths(packageName);
- } catch (RemoteException e) {
- // Should never happen!
- }
- return null;
- }
-
private final ContextImpl mContext;
private final IPackageManager mPM;
diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java
index 33b747cc85fe..1d217f030221 100644
--- a/core/java/android/app/BackStackRecord.java
+++ b/core/java/android/app/BackStackRecord.java
@@ -267,6 +267,14 @@ final class BackStackRecord extends FragmentTransaction implements
return mIndex;
}
+ public int getBreadCrumbTitleRes() {
+ return mBreadCrumbTitleRes;
+ }
+
+ public int getBreadCrumbShortTitleRes() {
+ return mBreadCrumbShortTitleRes;
+ }
+
public CharSequence getBreadCrumbTitle() {
if (mBreadCrumbTitleRes != 0) {
return mManager.mActivity.getText(mBreadCrumbTitleRes);
diff --git a/core/java/android/app/DialogFragment.java b/core/java/android/app/DialogFragment.java
index 6194240ef2fb..0bc89e722719 100644
--- a/core/java/android/app/DialogFragment.java
+++ b/core/java/android/app/DialogFragment.java
@@ -218,7 +218,7 @@ public class DialogFragment extends Fragment
* {@link FragmentTransaction#add(Fragment, String) FragmentTransaction.add}.
*/
public void show(FragmentManager manager, String tag) {
- FragmentTransaction ft = manager.openTransaction();
+ FragmentTransaction ft = manager.beginTransaction();
ft.add(this, tag);
ft.commit();
}
@@ -260,7 +260,7 @@ public class DialogFragment extends Fragment
FragmentManager.POP_BACK_STACK_INCLUSIVE);
mBackStackId = -1;
} else {
- FragmentTransaction ft = getFragmentManager().openTransaction();
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.remove(this);
if (allowStateLoss) {
ft.commitAllowingStateLoss();
@@ -295,7 +295,7 @@ public class DialogFragment extends Fragment
/**
* Return the current value of {@link #setCancelable(boolean)}.
*/
- public boolean getCancelable() {
+ public boolean isCancelable() {
return mCancelable;
}
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index 12f4a1868f6a..297d24604d00 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -28,6 +28,8 @@ import android.os.Binder;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.provider.Downloads;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
import android.util.Log;
import android.util.Pair;
@@ -1035,6 +1037,40 @@ public class DownloadManager {
}
/**
+ * Returns maximum size, in bytes, of downloads that may go over a mobile connection; or null if
+ * there's no limit
+ *
+ * @param context the {@link Context} to use for accessing the {@link ContentResolver}
+ * @return maximum size, in bytes, of downloads that may go over a mobile connection; or null if
+ * there's no limit
+ */
+ public static Long getMaxBytesOverMobile(Context context) {
+ try {
+ return Settings.Secure.getLong(context.getContentResolver(),
+ Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
+ } catch (SettingNotFoundException exc) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns recommended maximum size, in bytes, of downloads that may go over a mobile
+ * connection; or null if there's no recommended limit. The user will have the option to bypass
+ * this limit.
+ *
+ * @param context the {@link Context} to use for accessing the {@link ContentResolver}
+ * @return recommended maximum size, in bytes, of downloads that may go over a mobile
+ * connection; or null if there's no recommended limit.
+ */
+ public static Long getRecommendedMaxBytesOverMobile(Context context) {
+ try {
+ return Settings.Secure.getLong(context.getContentResolver(),
+ Settings.Secure.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
+ } catch (SettingNotFoundException exc) {
+ return null;
+ }
+ }
+ /**
* Get the DownloadProvider URI for the download with the given ID.
*/
Uri getDownloadUri(long id) {
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index 316e51370cf5..3280b221d47c 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -912,6 +912,12 @@ public class Fragment implements ComponentCallbacks, OnCreateContextMenuListener
return null;
}
+ /**
+ * Get the root view for the fragment's layout (the one returned by {@link #onCreateView}),
+ * if provided.
+ *
+ * @return The fragment's root view, or null if it has no layout.
+ */
public View getView() {
return mView;
}
diff --git a/core/java/android/app/FragmentBreadCrumbs.java b/core/java/android/app/FragmentBreadCrumbs.java
index fb890990d732..72a8e9a6feee 100644
--- a/core/java/android/app/FragmentBreadCrumbs.java
+++ b/core/java/android/app/FragmentBreadCrumbs.java
@@ -204,13 +204,13 @@ public class FragmentBreadCrumbs extends ViewGroup
void updateCrumbs() {
FragmentManager fm = mActivity.getFragmentManager();
- int numEntries = fm.countBackStackEntries();
+ int numEntries = fm.getBackStackEntryCount();
int numPreEntries = getPreEntryCount();
int numViews = mContainer.getChildCount();
for (int i = 0; i < numEntries + numPreEntries; i++) {
BackStackEntry bse = i < numPreEntries
? getPreEntry(i)
- : fm.getBackStackEntry(i - numPreEntries);
+ : fm.getBackStackEntryAt(i - numPreEntries);
if (i < numViews) {
View v = mContainer.getChildAt(i);
Object tag = v.getTag();
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index eb9b8a3795d3..bce240fc2ef0 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -49,7 +49,7 @@ public abstract class FragmentManager {
* Representation of an entry on the fragment back stack, as created
* with {@link FragmentTransaction#addToBackStack(String)
* FragmentTransaction.addToBackStack()}. Entries can later be
- * retrieved with {@link FragmentManager#getBackStackEntry(int)
+ * retrieved with {@link FragmentManager#getBackStackEntryAt(int)
* FragmentManager.getBackStackEntry()}.
*
* <p>Note that you should never hold on to a BackStackEntry object;
@@ -65,6 +65,18 @@ public abstract class FragmentManager {
public int getId();
/**
+ * Return the full bread crumb title resource identifier for the entry,
+ * or 0 if it does not have one.
+ */
+ public int getBreadCrumbTitleRes();
+
+ /**
+ * Return the short bread crumb title resource identifier for the entry,
+ * or 0 if it does not have one.
+ */
+ public int getBreadCrumbShortTitleRes();
+
+ /**
* Return the full bread crumb title for the entry, or null if it
* does not have one.
*/
@@ -100,8 +112,14 @@ public abstract class FragmentManager {
* in the state, and if changes are made after the state is saved then they
* will be lost.</p>
*/
- public abstract FragmentTransaction openTransaction();
+ public abstract FragmentTransaction beginTransaction();
+ /** @hide -- remove once prebuilts are in. */
+ @Deprecated
+ public FragmentTransaction openTransaction() {
+ return beginTransaction();
+ }
+
/**
* After a {@link FragmentTransaction} is committed with
* {@link FragmentTransaction#commit FragmentTransaction.commit()}, it
@@ -148,7 +166,9 @@ public abstract class FragmentManager {
/**
* Pop the top state off the back stack. Returns true if there was one
- * to pop, else false.
+ * to pop, else false. This function is asynchronous -- it enqueues the
+ * request to pop, but the action will not be performed until the application
+ * returns to its event loop.
*/
public abstract void popBackStack();
@@ -163,6 +183,10 @@ public abstract class FragmentManager {
/**
* Pop the last fragment transition from the manager's fragment
* back stack. If there is nothing to pop, false is returned.
+ * This function is asynchronous -- it enqueues the
+ * request to pop, but the action will not be performed until the application
+ * returns to its event loop.
+ *
* @param name If non-null, this is the name of a previous back state
* to look for; if found, all states up to that state will be popped. The
* {@link #POP_BACK_STACK_INCLUSIVE} flag can be used to control whether
@@ -181,6 +205,10 @@ public abstract class FragmentManager {
/**
* Pop all back stack states up to the one with the given identifier.
+ * This function is asynchronous -- it enqueues the
+ * request to pop, but the action will not be performed until the application
+ * returns to its event loop.
+ *
* @param id Identifier of the stated to be popped. If no identifier exists,
* false is returned.
* The identifier is the number returned by
@@ -202,13 +230,13 @@ public abstract class FragmentManager {
/**
* Return the number of entries currently in the back stack.
*/
- public abstract int countBackStackEntries();
+ public abstract int getBackStackEntryCount();
/**
* Return the BackStackEntry at index <var>index</var> in the back stack;
* entries start index 0 being the bottom of the stack.
*/
- public abstract BackStackEntry getBackStackEntry(int index);
+ public abstract BackStackEntry getBackStackEntryAt(int index);
/**
* Add a new listener for changes to the fragment back stack.
@@ -347,7 +375,7 @@ final class FragmentManagerImpl extends FragmentManager {
};
@Override
- public FragmentTransaction openTransaction() {
+ public FragmentTransaction beginTransaction() {
return new BackStackRecord(this);
}
@@ -411,12 +439,12 @@ final class FragmentManagerImpl extends FragmentManager {
}
@Override
- public int countBackStackEntries() {
+ public int getBackStackEntryCount() {
return mBackStack != null ? mBackStack.size() : 0;
}
@Override
- public BackStackEntry getBackStackEntry(int index) {
+ public BackStackEntry getBackStackEntryAt(int index) {
return mBackStack.get(index);
}
@@ -1673,11 +1701,8 @@ final class FragmentManagerImpl extends FragmentManager {
case FragmentTransaction.TRANSIT_FRAGMENT_CLOSE:
rev = FragmentTransaction.TRANSIT_FRAGMENT_OPEN;
break;
- case FragmentTransaction.TRANSIT_FRAGMENT_NEXT:
- rev = FragmentTransaction.TRANSIT_FRAGMENT_PREV;
- break;
- case FragmentTransaction.TRANSIT_FRAGMENT_PREV:
- rev = FragmentTransaction.TRANSIT_FRAGMENT_NEXT;
+ case FragmentTransaction.TRANSIT_FRAGMENT_FADE:
+ rev = FragmentTransaction.TRANSIT_FRAGMENT_FADE;
break;
}
return rev;
@@ -1697,15 +1722,10 @@ final class FragmentManagerImpl extends FragmentManager {
? com.android.internal.R.styleable.FragmentAnimation_fragmentCloseEnterAnimation
: com.android.internal.R.styleable.FragmentAnimation_fragmentCloseExitAnimation;
break;
- case FragmentTransaction.TRANSIT_FRAGMENT_NEXT:
- animAttr = enter
- ? com.android.internal.R.styleable.FragmentAnimation_fragmentNextEnterAnimation
- : com.android.internal.R.styleable.FragmentAnimation_fragmentNextExitAnimation;
- break;
- case FragmentTransaction.TRANSIT_FRAGMENT_PREV:
+ case FragmentTransaction.TRANSIT_FRAGMENT_FADE:
animAttr = enter
- ? com.android.internal.R.styleable.FragmentAnimation_fragmentPrevEnterAnimation
- : com.android.internal.R.styleable.FragmentAnimation_fragmentPrevExitAnimation;
+ ? com.android.internal.R.styleable.FragmentAnimation_fragmentFadeEnterAnimation
+ : com.android.internal.R.styleable.FragmentAnimation_fragmentFadeExitAnimation;
break;
}
return animAttr;
diff --git a/core/java/android/app/FragmentTransaction.java b/core/java/android/app/FragmentTransaction.java
index 1b8debcda993..0cc774d3d2f9 100644
--- a/core/java/android/app/FragmentTransaction.java
+++ b/core/java/android/app/FragmentTransaction.java
@@ -110,10 +110,9 @@ public abstract class FragmentTransaction {
public static final int TRANSIT_FRAGMENT_OPEN = 1 | TRANSIT_ENTER_MASK;
/** Fragment is being removed from the stack */
public static final int TRANSIT_FRAGMENT_CLOSE = 2 | TRANSIT_EXIT_MASK;
- /** Fragment is being added in a 'next' operation*/
- public static final int TRANSIT_FRAGMENT_NEXT = 3 | TRANSIT_ENTER_MASK;
- /** Fragment is being removed in a 'previous' operation */
- public static final int TRANSIT_FRAGMENT_PREV = 4 | TRANSIT_EXIT_MASK;
+ /** Fragment should simply fade in or out; that is, no strong navigation associated
+ * with it except that it is appearing or disappearing for some reason. */
+ public static final int TRANSIT_FRAGMENT_FADE = 3 | TRANSIT_ENTER_MASK;
/**
* Set specific animation resources to run for the fragments that are
diff --git a/core/java/android/app/LoaderManager.java b/core/java/android/app/LoaderManager.java
index 5f8c0984982d..ffe2a5d68aaf 100644
--- a/core/java/android/app/LoaderManager.java
+++ b/core/java/android/app/LoaderManager.java
@@ -60,7 +60,7 @@ public abstract class LoaderManager {
* Called when a previously created loader has finished its load. Note
* that normally an application is <em>not</em> allowed to commit fragment
* transactions while in this call, since it can happen after an
- * activity's state is saved. See {@link FragmentManager#openTransaction()
+ * activity's state is saved. See {@link FragmentManager#beginTransaction()
* FragmentManager.openTransaction()} for further discussion on this.
*
* <p>This function is guaranteed to be called prior to the release of
@@ -159,14 +159,6 @@ public abstract class LoaderManager {
public abstract void destroyLoader(int id);
/**
- * @deprecated Renamed to {@link #destroyLoader}.
- */
- @Deprecated
- public void stopLoader(int id) {
- destroyLoader(id);
- }
-
- /**
* Return the Loader with the given id or null if no matching Loader
* is found.
*/
@@ -353,7 +345,7 @@ class LoaderManagerImpl extends LoaderManager {
// Notify of the new data so the app can switch out the old data before
// we try to destroy it.
- if (mData != data) {
+ if (data == null || mData != data) {
mData = data;
if (mStarted) {
callOnLoadFinished(loader, data);
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4186fecb4cb0..3f3aa749f9c0 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1093,38 +1093,32 @@ public class DevicePolicyManager {
}
/**
- * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+ * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
* indicating that encryption is not supported.
*/
public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0;
/**
- * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+ * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
* indicating that encryption is supported, but is not currently active.
*/
public static final int ENCRYPTION_STATUS_INACTIVE = 1;
/**
- * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
- * indicating that encryption is not currently active, but has been requested.
- */
- public static final int ENCRYPTION_STATUS_REQUESTED = 2;
-
- /**
- * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+ * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
* indicating that encryption is not currently active, but is currently
* being activated. This is only reported by devices that support
* encryption of data and only when the storage is currently
* undergoing a process of becoming encrypted. A device that must reboot and/or wipe data
* to become encrypted will never return this value.
*/
- public static final int ENCRYPTION_STATUS_ACTIVATING = 3;
+ public static final int ENCRYPTION_STATUS_ACTIVATING = 2;
/**
- * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+ * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
* indicating that encryption is active.
*/
- public static final int ENCRYPTION_STATUS_ACTIVE = 4;
+ public static final int ENCRYPTION_STATUS_ACTIVE = 3;
/**
* Activity action: begin the process of encrypting data on the device. This activity should
@@ -1139,14 +1133,7 @@ public class DevicePolicyManager {
/**
* Called by an application that is administering the device to
- * request that the storage system be encrypted. Depending
- * on the returned status code, the caller may proceed in different
- * ways. If the result is {@link #ENCRYPTION_STATUS_UNSUPPORTED}, the
- * storage system does not support encryption. If the
- * result is {@link #ENCRYPTION_STATUS_REQUESTED}, use {@link
- * #ACTION_START_ENCRYPTION} to begin the process of encrypting or decrypting the
- * storage. If the result is {@link #ENCRYPTION_STATUS_ACTIVATING} or
- * {@link #ENCRYPTION_STATUS_ACTIVE}, no further action is required.
+ * request that the storage system be encrypted.
*
* <p>When multiple device administrators attempt to control device
* encryption, the most secure, supported setting will always be
@@ -1167,7 +1154,10 @@ public class DevicePolicyManager {
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
* @param encrypt true to request encryption, false to release any previous request
- * @return current status of encryption
+ * @return the new request status (for all active admins) - will be one of
+ * {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE}, or
+ * {@link #ENCRYPTION_STATUS_ACTIVE}. This is the value of the requests; Use
+ * {@link #getStorageEncryptionStatus()} to query the actual device state.
*/
public int setStorageEncryption(ComponentName admin, boolean encrypt) {
if (mService != null) {
@@ -1182,12 +1172,14 @@ public class DevicePolicyManager {
/**
* Called by an application that is administering the device to
- * determine the encryption status of a specific storage system.
+ * determine the requested setting for secure storage.
*
- * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
- * @return current status of encryption
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with. If null,
+ * this will return the requested encryption setting as an aggregate of all active
+ * administrators.
+ * @return true if the admin(s) are requesting encryption, false if not.
*/
- public int getStorageEncryption(ComponentName admin) {
+ public boolean getStorageEncryption(ComponentName admin) {
if (mService != null) {
try {
return mService.getStorageEncryption(admin);
@@ -1195,6 +1187,33 @@ public class DevicePolicyManager {
Log.w(TAG, "Failed talking with device policy service", e);
}
}
+ return false;
+ }
+
+ /**
+ * Called by an application that is administering the device to
+ * determine the current encryption status of the device.
+ *
+ * Depending on the returned status code, the caller may proceed in different
+ * ways. If the result is {@link #ENCRYPTION_STATUS_UNSUPPORTED}, the
+ * storage system does not support encryption. If the
+ * result is {@link #ENCRYPTION_STATUS_INACTIVE}, use {@link
+ * #ACTION_START_ENCRYPTION} to begin the process of encrypting or decrypting the
+ * storage. If the result is {@link #ENCRYPTION_STATUS_ACTIVATING} or
+ * {@link #ENCRYPTION_STATUS_ACTIVE}, no further action is required.
+ *
+ * @return current status of encryption. The value will be one of
+ * {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE},
+ * {@link #ENCRYPTION_STATUS_ACTIVATING}, or{@link #ENCRYPTION_STATUS_ACTIVE}.
+ */
+ public int getStorageEncryptionStatus() {
+ if (mService != null) {
+ try {
+ return mService.getStorageEncryptionStatus();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
return ENCRYPTION_STATUS_UNSUPPORTED;
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index d3b5cf314e8d..e8caca153467 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -76,7 +76,8 @@ interface IDevicePolicyManager {
ComponentName getGlobalProxyAdmin();
int setStorageEncryption(in ComponentName who, boolean encrypt);
- int getStorageEncryption(in ComponentName who);
+ boolean getStorageEncryption(in ComponentName who);
+ int getStorageEncryptionStatus();
void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing);
boolean isAdminActive(in ComponentName policyReceiver);
diff --git a/core/java/android/content/AsyncTaskLoader.java b/core/java/android/content/AsyncTaskLoader.java
index c6b9e805afce..3d6182b9fe7f 100644
--- a/core/java/android/content/AsyncTaskLoader.java
+++ b/core/java/android/content/AsyncTaskLoader.java
@@ -168,6 +168,11 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> {
* Called if the task was canceled before it was completed. Gives the class a chance
* to properly dispose of the result.
*/
+ public void onCanceled(D data) {
+ onCancelled(data);
+ }
+
+ @Deprecated
public void onCancelled(D data) {
}
@@ -195,7 +200,7 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> {
}
void dispatchOnCancelled(LoadTask task, D data) {
- onCancelled(data);
+ onCanceled(data);
if (mCancellingTask == task) {
if (DEBUG) Slog.v(TAG, "Cancelled task is now canceled!");
mLastLoadCompleteTime = SystemClock.uptimeMillis();
@@ -240,6 +245,8 @@ public abstract class AsyncTaskLoader<D> extends Loader<D> {
* thread would cause a deadlock.
* <p>
* Use for testing only. <b>Never</b> call this from a UI thread.
+ *
+ * @hide
*/
public void waitForLoader() {
LoadTask task = mTask;
diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java
index 5939643e85a8..028149b3760b 100644
--- a/core/java/android/content/BroadcastReceiver.java
+++ b/core/java/android/content/BroadcastReceiver.java
@@ -170,6 +170,16 @@ public abstract class BroadcastReceiver {
* State for a result that is pending for a broadcast receiver. Returned
* by {@link BroadcastReceiver#goAsync() goAsync()}
* while in {@link BroadcastReceiver#onReceive BroadcastReceiver.onReceive()}.
+ * This allows you to return from onReceive() without having the broadcast
+ * terminate; you must call {@link #finish()} once you are done with the
+ * broadcast. This allows you to process the broadcast off of the main
+ * thread of your app.
+ *
+ * <p>Note on threading: the state inside of this class is not itself
+ * thread-safe, however you can use it from any thread if you properly
+ * sure that you do not have races. Typically this means you will hand
+ * the entire object to another thread, which will be solely responsible
+ * for setting any results and finally calling {@link #finish()}.
*/
public static class PendingResult {
/** @hide */
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java
index 6f4d098075dc..d9c6b0748f31 100644
--- a/core/java/android/content/ClipData.java
+++ b/core/java/android/content/ClipData.java
@@ -42,9 +42,9 @@ import java.util.ArrayList;
* {@link ClipDescription#getMimeType(int) getDescription().getMimeType(int)}
* must return correct MIME type(s) describing the data in the clip. For help
* in correctly constructing a clip with the correct MIME type, use
- * {@link #newPlainText(CharSequence, Bitmap, CharSequence)},
- * {@link #newUri(ContentResolver, CharSequence, Bitmap, Uri)}, and
- * {@link #newIntent(CharSequence, Bitmap, Intent)}.
+ * {@link #newPlainText(CharSequence, CharSequence)},
+ * {@link #newUri(ContentResolver, CharSequence, Uri)}, and
+ * {@link #newIntent(CharSequence, Intent)}.
*
* <p>Each Item instance can be one of three main classes of data: a simple
* CharSequence of text, a single Intent object, or a Uri. See {@link Item}
@@ -70,7 +70,7 @@ import java.util.ArrayList;
* "content:" URIs. A content URI allows the recipient of a ClippedData item
* to interact closely with the ContentProvider holding the data in order to
* negotiate the transfer of that data. The clip must also be filled in with
- * the available MIME types; {@link #newUri(ContentResolver, CharSequence, Bitmap, Uri)}
+ * the available MIME types; {@link #newUri(ContentResolver, CharSequence, Uri)}
* will take care of correctly doing this.
*
* <p>For example, here is the paste function of a simple NotePad application.
@@ -321,16 +321,14 @@ public class ClipData implements Parcelable {
*
* @param label Label to show to the user describing this clip.
* @param mimeTypes An array of MIME types this data is available as.
- * @param icon Bitmap providing the user with an iconing representation of
- * the clip.
* @param item The contents of the first item in the clip.
*/
- public ClipData(CharSequence label, String[] mimeTypes, Bitmap icon, Item item) {
+ public ClipData(CharSequence label, String[] mimeTypes, Item item) {
mClipDescription = new ClipDescription(label, mimeTypes);
if (item == null) {
throw new NullPointerException("item is null");
}
- mIcon = icon;
+ mIcon = null;
mItems.add(item);
}
@@ -338,16 +336,14 @@ public class ClipData implements Parcelable {
* Create a new clip.
*
* @param description The ClipDescription describing the clip contents.
- * @param icon Bitmap providing the user with an iconing representation of
- * the clip.
* @param item The contents of the first item in the clip.
*/
- public ClipData(ClipDescription description, Bitmap icon, Item item) {
+ public ClipData(ClipDescription description, Item item) {
mClipDescription = description;
if (item == null) {
throw new NullPointerException("item is null");
}
- mIcon = icon;
+ mIcon = null;
mItems.add(item);
}
@@ -356,13 +352,12 @@ public class ClipData implements Parcelable {
* {@link ClipDescription#MIMETYPE_TEXT_PLAIN}.
*
* @param label User-visible label for the clip data.
- * @param icon Iconic representation of the clip data.
* @param text The actual text in the clip.
* @return Returns a new ClipData containing the specified data.
*/
- static public ClipData newPlainText(CharSequence label, Bitmap icon, CharSequence text) {
+ static public ClipData newPlainText(CharSequence label, CharSequence text) {
Item item = new Item(text);
- return new ClipData(label, MIMETYPES_TEXT_PLAIN, icon, item);
+ return new ClipData(label, MIMETYPES_TEXT_PLAIN, item);
}
/**
@@ -370,13 +365,12 @@ public class ClipData implements Parcelable {
* {@link ClipDescription#MIMETYPE_TEXT_INTENT}.
*
* @param label User-visible label for the clip data.
- * @param icon Iconic representation of the clip data.
* @param intent The actual Intent in the clip.
* @return Returns a new ClipData containing the specified data.
*/
- static public ClipData newIntent(CharSequence label, Bitmap icon, Intent intent) {
+ static public ClipData newIntent(CharSequence label, Intent intent) {
Item item = new Item(intent);
- return new ClipData(label, MIMETYPES_TEXT_INTENT, icon, item);
+ return new ClipData(label, MIMETYPES_TEXT_INTENT, item);
}
/**
@@ -387,12 +381,11 @@ public class ClipData implements Parcelable {
*
* @param resolver ContentResolver used to get information about the URI.
* @param label User-visible label for the clip data.
- * @param icon Iconic representation of the clip data.
* @param uri The URI in the clip.
* @return Returns a new ClipData containing the specified data.
*/
static public ClipData newUri(ContentResolver resolver, CharSequence label,
- Bitmap icon, Uri uri) {
+ Uri uri) {
Item item = new Item(uri);
String[] mimeTypes = null;
if ("content".equals(uri.getScheme())) {
@@ -417,24 +410,23 @@ public class ClipData implements Parcelable {
if (mimeTypes == null) {
mimeTypes = MIMETYPES_TEXT_URILIST;
}
- return new ClipData(label, mimeTypes, icon, item);
+ return new ClipData(label, mimeTypes, item);
}
/**
* Create a new ClipData holding an URI with MIME type
* {@link ClipDescription#MIMETYPE_TEXT_URILIST}.
- * Unlike {@link #newUri(ContentResolver, CharSequence, Bitmap, Uri)}, nothing
+ * Unlike {@link #newUri(ContentResolver, CharSequence, Uri)}, nothing
* is inferred about the URI -- if it is a content: URI holding a bitmap,
* the reported type will still be uri-list. Use this with care!
*
* @param label User-visible label for the clip data.
- * @param icon Iconic representation of the clip data.
* @param uri The URI in the clip.
* @return Returns a new ClipData containing the specified data.
*/
- static public ClipData newRawUri(CharSequence label, Bitmap icon, Uri uri) {
+ static public ClipData newRawUri(CharSequence label, Uri uri) {
Item item = new Item(uri);
- return new ClipData(label, MIMETYPES_TEXT_URILIST, icon, item);
+ return new ClipData(label, MIMETYPES_TEXT_URILIST, item);
}
/**
@@ -445,6 +437,9 @@ public class ClipData implements Parcelable {
return mClipDescription;
}
+ /**
+ * Add a new Item to the overall ClipData container.
+ */
public void addItem(Item item) {
if (item == null) {
throw new NullPointerException("item is null");
@@ -452,15 +447,23 @@ public class ClipData implements Parcelable {
mItems.add(item);
}
+ /** @hide */
public Bitmap getIcon() {
return mIcon;
}
+ /**
+ * Return the number of items in the clip data.
+ */
public int getItemCount() {
return mItems.size();
}
- public Item getItem(int index) {
+ /**
+ * Return a single item inside of the clip data. The index can range
+ * from 0 to {@link #getItemCount()}-1.
+ */
+ public Item getItemAt(int index) {
return mItems.get(index);
}
diff --git a/core/java/android/content/ClipboardManager.java b/core/java/android/content/ClipboardManager.java
index 3e2b763ecdd8..a79f0602ad11 100644
--- a/core/java/android/content/ClipboardManager.java
+++ b/core/java/android/content/ClipboardManager.java
@@ -170,7 +170,7 @@ public class ClipboardManager extends android.text.ClipboardManager {
public CharSequence getText() {
ClipData clip = getPrimaryClip();
if (clip != null && clip.getItemCount() > 0) {
- return clip.getItem(0).coerceToText(mContext);
+ return clip.getItemAt(0).coerceToText(mContext);
}
return null;
}
@@ -181,7 +181,7 @@ public class ClipboardManager extends android.text.ClipboardManager {
* primary clip. It has no label or icon.
*/
public void setText(CharSequence text) {
- setPrimaryClip(ClipData.newPlainText(null, null, text));
+ setPrimaryClip(ClipData.newPlainText(null, text));
}
/**
diff --git a/core/java/android/content/CursorLoader.java b/core/java/android/content/CursorLoader.java
index 38ebaf2ffc20..6228bd059f2d 100644
--- a/core/java/android/content/CursorLoader.java
+++ b/core/java/android/content/CursorLoader.java
@@ -26,6 +26,17 @@ import java.util.Arrays;
/**
* A loader that queries the {@link ContentResolver} and returns a {@link Cursor}.
+ * This class implements the {@link Loader} protocol in a standard way for
+ * querying cursors, building on {@link AsyncTaskLoader} to perform the cursor
+ * query on a background thread so that it does not block the application's UI.
+ *
+ * <p>A CursorLoader must be built with the full information for the query to
+ * perform, either through the
+ * {@link #CursorLoader(Context, Uri, String[], String, String[], String)} or
+ * creating an empty instance with {@link #CursorLoader(Context)} and filling
+ * in the desired paramters with {@link #setUri(Uri)}, {@link #setSelection(String)},
+ * {@link #setSelectionArgs(String[])}, {@link #setSortOrder(String)},
+ * and {@link #setProjection(String[])}.
*/
public class CursorLoader extends AsyncTaskLoader<Cursor> {
final ForceLoadContentObserver mObserver;
@@ -81,6 +92,22 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
}
}
+ /**
+ * Creates an empty unspecified CursorLoader. You must follow this with
+ * calls to {@link #setUri(Uri)}, {@link #setSelection(String)}, etc
+ * to specify the query to perform.
+ */
+ public CursorLoader(Context context) {
+ super(context);
+ mObserver = new ForceLoadContentObserver();
+ }
+
+ /**
+ * Creates a fully-specified CursorLoader. See
+ * {@link ContentResolver#query(Uri, String[], String, String[], String)
+ * ContentResolver.query()} for documentation on the meaning of the
+ * parameters. These will be passed as-is to that call.
+ */
public CursorLoader(Context context, Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
super(context);
@@ -119,7 +146,7 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
}
@Override
- public void onCancelled(Cursor cursor) {
+ public void onCanceled(Cursor cursor) {
if (cursor != null && !cursor.isClosed()) {
cursor.close();
}
diff --git a/core/java/android/content/XmlDocumentProvider.java b/core/java/android/content/XmlDocumentProvider.java
index 153ad38b8bfd..76539c75ba1c 100644
--- a/core/java/android/content/XmlDocumentProvider.java
+++ b/core/java/android/content/XmlDocumentProvider.java
@@ -40,6 +40,8 @@ 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
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index e688c86d0f9b..46f611fba8cb 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -149,7 +149,13 @@ public class ActivityInfo extends ComponentInfo
* {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
*/
public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
- /**
+ /**
+ * Value for {@link #flags}: true when the application's rendering should
+ * be hardware accelerated.
+ */
+ public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
+ /**
+ * @hide
* Bit in {@link #flags} corresponding to an immersive activity
* that wishes not to be interrupted by notifications.
* Applications that hide the system notification bar with
@@ -164,12 +170,7 @@ public class ActivityInfo extends ComponentInfo
* "toast" window).
* {@see android.app.Notification#FLAG_HIGH_PRIORITY}
*/
- public static final int FLAG_IMMERSIVE = 0x0200;
- /**
- * Value for {@link #flags}: true when the application's rendering should
- * be hardware accelerated.
- */
- public static final int FLAG_HARDWARE_ACCELERATED = 0x0400;
+ public static final int FLAG_IMMERSIVE = 0x0400;
/**
* Options that have been set in the activity declaration in the
* manifest.
@@ -180,7 +181,7 @@ public class ActivityInfo extends ComponentInfo
* {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
* {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
* {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
- * {@link #FLAG_IMMERSIVE}, {@link #FLAG_HARDWARE_ACCELERATED}
+ * {@link #FLAG_HARDWARE_ACCELERATED}
*/
public int flags;
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 28e1a63b2c65..034525e7f39b 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -323,7 +323,4 @@ interface IPackageManager {
boolean setInstallLocation(int loc);
int getInstallLocation();
-
- void setPackageObbPaths(in String packageName, in String[] paths);
- String[] getPackageObbPaths(in String packageName);
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 47418aa139a3..6e9cdbeb8f6f 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2289,32 +2289,4 @@ public abstract class PackageManager {
*/
public abstract void movePackage(
String packageName, IPackageMoveObserver observer, int flags);
-
- /**
- * Sets the Opaque Binary Blob (OBB) file path associated with a package
- * name. The caller must have the
- * {@link android.Manifest.permission#INSTALL_PACKAGES} permission.
- * <p>
- * NOTE: The existence or format of this file is not currently checked, but
- * it may be in the future.
- *
- * @param packageName Name of the package with which to associate the .obb
- * file.
- * @param paths Arrays of paths on the filesystem to the .obb files
- * associated with the package.
- * @see #getPackageObbPaths(String)
- */
- public abstract void setPackageObbPaths(String packageName, String[] paths);
-
- /**
- * Gets the Opaque Binary Blob (OBB) file path associated with the package.
- * The caller must be the owner of the package queried or have the
- * {@link android.Manifest.permission#INSTALL_PACKAGES} permission.
- *
- * @param packageName Name of the package with which to associate the .obb
- * file.
- * @return array of paths to .obb files associated with the package
- * @see #setPackageObbPaths(String, String[])
- */
- public abstract String[] getPackageObbPaths(String packageName);
}
diff --git a/core/java/android/content/pm/PackageStats.java b/core/java/android/content/pm/PackageStats.java
index 28a288647885..11068e5d164e 100755
--- a/core/java/android/content/pm/PackageStats.java
+++ b/core/java/android/content/pm/PackageStats.java
@@ -55,6 +55,9 @@ public class PackageStats implements Parcelable {
/** Size of the external media size used by the application. */
public long externalMediaSize;
+ /** Size of the package's OBBs placed on external media. */
+ public long externalObbSize;
+
public static final Parcelable.Creator<PackageStats> CREATOR
= new Parcelable.Creator<PackageStats>() {
public PackageStats createFromParcel(Parcel in) {
@@ -83,6 +86,8 @@ public class PackageStats implements Parcelable {
sb.append(externalCacheSize);
sb.append(",externalMediaSize=");
sb.append(externalMediaSize);
+ sb.append(",externalObbSize=");
+ sb.append(externalObbSize);
return sb.toString();
}
@@ -98,6 +103,7 @@ public class PackageStats implements Parcelable {
externalDataSize = source.readLong();
externalCacheSize = source.readLong();
externalMediaSize = source.readLong();
+ externalObbSize = source.readLong();
}
public PackageStats(PackageStats pStats) {
@@ -108,6 +114,7 @@ public class PackageStats implements Parcelable {
externalDataSize = pStats.externalDataSize;
externalCacheSize = pStats.externalCacheSize;
externalMediaSize = pStats.externalMediaSize;
+ externalObbSize = pStats.externalObbSize;
}
public int describeContents() {
@@ -122,5 +129,6 @@ public class PackageStats implements Parcelable {
dest.writeLong(externalDataSize);
dest.writeLong(externalCacheSize);
dest.writeLong(externalMediaSize);
+ dest.writeLong(externalObbSize);
}
}
diff --git a/core/java/android/database/DefaultDatabaseErrorHandler.java b/core/java/android/database/DefaultDatabaseErrorHandler.java
index 3619e487256f..61337dde6c3a 100644
--- a/core/java/android/database/DefaultDatabaseErrorHandler.java
+++ b/core/java/android/database/DefaultDatabaseErrorHandler.java
@@ -24,8 +24,22 @@ import android.util.Log;
import android.util.Pair;
/**
- * Default class used defining the actions to take when the following errors are detected
- * database corruption
+ * Default class used to define the actions to take when the database corruption is reported
+ * by sqlite.
+ * <p>
+ * An application can specify an implementation of {@link DatabaseErrorHandler} on the
+ * following:
+ * <ul>
+ * <li>{@link SQLiteDatabase#openOrCreateDatabase(String,
+ * android.database.sqlite.SQLiteDatabase.CursorFactory, DatabaseErrorHandler)}</li>
+ * <li>{@link SQLiteDatabase#openDatabase(String,
+ * android.database.sqlite.SQLiteDatabase.CursorFactory, int, DatabaseErrorHandler)}</li>
+ * </ul>
+ * The specified {@link DatabaseErrorHandler} is used to handle database corruption errors, if they
+ * occur.
+ * <p>
+ * If null is specified for DatabaeErrorHandler param in the above calls, then this class is used
+ * as the default {@link DatabaseErrorHandler}.
*/
public final class DefaultDatabaseErrorHandler implements DatabaseErrorHandler {
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index 980048c5138e..d1bbaa49abbd 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -39,14 +39,36 @@ public class InterfaceConfiguration implements Parcelable {
public String toString() {
StringBuffer str = new StringBuffer();
- str.append("ipddress "); str.append(addr.toString());
- str.append(" netmask "); str.append(mask.toString());
+ str.append("ipddress ");
+ str.append((addr != null) ? addr.toString() : "NULL");
+ str.append(" netmask ");
+ str.append((mask != null) ? mask.toString() : "NULL");
str.append(" flags ").append(interfaceFlags);
str.append(" hwaddr ").append(hwAddr);
return str.toString();
}
+ /**
+ * This function determines if the interface is up and has a valid IP
+ * configuration (IP address has a non zero octet).
+ *
+ * Note: It is supposed to be quick and hence should not initiate
+ * any network activity
+ */
+ public boolean isActive() {
+ try {
+ if(interfaceFlags.contains("up")) {
+ for (byte b : addr.getAddress()) {
+ if (b != 0) return true;
+ }
+ }
+ } catch (NullPointerException e) {
+ return false;
+ }
+ return false;
+ }
+
/** Implement the Parcelable interface {@hide} */
public int describeContents() {
return 0;
diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java
index cc956428fb5a..904b2e940a4d 100644
--- a/core/java/android/os/Environment.java
+++ b/core/java/android/os/Environment.java
@@ -20,22 +20,19 @@ import java.io.File;
import android.content.res.Resources;
import android.os.storage.IMountService;
+import android.util.Log;
/**
* Provides access to environment variables.
*/
public class Environment {
+ private static final String TAG = "Environment";
private static final File ROOT_DIRECTORY
= getDirectory("ANDROID_ROOT", "/system");
private static final String SYSTEM_PROPERTY_EFS_ENABLED = "persist.security.efs.enabled";
- private static class MountServiceHolder {
- static IMountService mSingleton = IMountService.Stub.asInterface(ServiceManager
- .getService("mount"));
- }
-
private static final Object mLock = new Object();
private volatile static Boolean mIsExternalStorageEmulated = null;
@@ -401,7 +398,9 @@ public class Environment {
*/
public static String getExternalStorageState() {
try {
- return MountServiceHolder.mSingleton.getVolumeState(getExternalStorageDirectory()
+ IMountService mountService = IMountService.Stub.asInterface(ServiceManager
+ .getService("mount"));
+ return mountService.getVolumeState(getExternalStorageDirectory()
.toString());
} catch (Exception rex) {
return Environment.MEDIA_REMOVED;
@@ -433,12 +432,14 @@ public class Environment {
if (mIsExternalStorageEmulated == null) {
boolean externalStorageEmulated;
try {
- externalStorageEmulated =
- MountServiceHolder.mSingleton.isExternalStorageEmulated();
+ IMountService mountService = IMountService.Stub.asInterface(ServiceManager
+ .getService("mount"));
+ externalStorageEmulated = mountService.isExternalStorageEmulated();
+ mIsExternalStorageEmulated = Boolean.valueOf(externalStorageEmulated);
} catch (Exception e) {
- externalStorageEmulated = false;
+ Log.e(TAG, "couldn't talk to MountService", e);
+ return false;
}
- mIsExternalStorageEmulated = Boolean.valueOf(externalStorageEmulated);
}
}
}
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 0f062ccb606d..997ea53cfc97 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -34,6 +34,7 @@ import dalvik.system.CloseGuard;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -166,13 +167,19 @@ public final class StrictMode {
* Note, a "VM_" bit, not thread.
* @hide
*/
- public static final int DETECT_VM_CURSOR_LEAKS = 0x200; // for ProcessPolicy
+ public static final int DETECT_VM_CURSOR_LEAKS = 0x200; // for VmPolicy
/**
* Note, a "VM_" bit, not thread.
* @hide
*/
- public static final int DETECT_VM_CLOSABLE_LEAKS = 0x400; // for ProcessPolicy
+ public static final int DETECT_VM_CLOSABLE_LEAKS = 0x400; // for VmPolicy
+
+ /**
+ * Note, a "VM_" bit, not thread.
+ * @hide
+ */
+ public static final int DETECT_VM_ACTIVITY_LEAKS = 0x800; // for VmPolicy
/**
* @hide
@@ -232,10 +239,18 @@ public final class StrictMode {
PENALTY_LOG | PENALTY_DIALOG | PENALTY_DEATH | PENALTY_DROPBOX | PENALTY_GATHER |
PENALTY_DEATH_ON_NETWORK | PENALTY_FLASH;
+
+ // TODO: wrap in some ImmutableHashMap thing.
+ // Note: must be before static initialization of sVmPolicy.
+ private static final HashMap<Class, Integer> EMPTY_CLASS_LIMIT_MAP = new HashMap<Class, Integer>();
+
/**
* The current VmPolicy in effect.
+ *
+ * TODO: these are redundant (mask is in VmPolicy). Should remove sVmPolicyMask.
*/
private static volatile int sVmPolicyMask = 0;
+ private static volatile VmPolicy sVmPolicy = VmPolicy.LAX;
/**
* The number of threads trying to do an async dropbox write.
@@ -481,12 +496,19 @@ public final class StrictMode {
/**
* The default, lax policy which doesn't catch anything.
*/
- public static final VmPolicy LAX = new VmPolicy(0);
+ public static final VmPolicy LAX = new VmPolicy(0, EMPTY_CLASS_LIMIT_MAP);
final int mask;
- private VmPolicy(int mask) {
+ // Map from class to max number of allowed instances in memory.
+ final HashMap<Class, Integer> classInstanceLimit;
+
+ private VmPolicy(int mask, HashMap<Class, Integer> classInstanceLimit) {
+ if (classInstanceLimit == null) {
+ throw new NullPointerException("classInstanceLimit == null");
+ }
this.mask = mask;
+ this.classInstanceLimit = classInstanceLimit;
}
@Override
@@ -516,6 +538,49 @@ public final class StrictMode {
public static final class Builder {
private int mMask;
+ private HashMap<Class, Integer> mClassInstanceLimit; // null until needed
+ private boolean mClassInstanceLimitNeedCow = false; // need copy-on-write
+
+ public Builder() {
+ mMask = 0;
+ }
+
+ /**
+ * Build upon an existing VmPolicy.
+ */
+ public Builder(VmPolicy base) {
+ mMask = base.mask;
+ mClassInstanceLimitNeedCow = true;
+ mClassInstanceLimit = base.classInstanceLimit;
+ }
+
+ /**
+ * Set an upper bound on how many instances of a class can be in memory
+ * at once. Helps to prevent object leaks.
+ */
+ public Builder setClassInstanceLimit(Class klass, int instanceLimit) {
+ if (klass == null) {
+ throw new NullPointerException("klass == null");
+ }
+ if (mClassInstanceLimitNeedCow) {
+ if (mClassInstanceLimit.containsKey(klass) &&
+ mClassInstanceLimit.get(klass) == instanceLimit) {
+ // no-op; don't break COW
+ return this;
+ }
+ mClassInstanceLimitNeedCow = false;
+ mClassInstanceLimit = (HashMap<Class, Integer>) mClassInstanceLimit.clone();
+ } else if (mClassInstanceLimit == null) {
+ mClassInstanceLimit = new HashMap<Class, Integer>();
+ }
+ mClassInstanceLimit.put(klass, instanceLimit);
+ return this;
+ }
+
+ private Builder detectActivityLeaks() {
+ return enable(DETECT_VM_ACTIVITY_LEAKS);
+ }
+
/**
* Detect everything that's potentially suspect.
*
@@ -524,7 +589,8 @@ public final class StrictMode {
* likely expand in future releases.
*/
public Builder detectAll() {
- return enable(DETECT_VM_CURSOR_LEAKS | DETECT_VM_CLOSABLE_LEAKS);
+ return enable(DETECT_VM_ACTIVITY_LEAKS |
+ DETECT_VM_CURSOR_LEAKS | DETECT_VM_CLOSABLE_LEAKS);
}
/**
@@ -598,7 +664,8 @@ public final class StrictMode {
PENALTY_DROPBOX | PENALTY_DIALOG)) == 0) {
penaltyLog();
}
- return new VmPolicy(mMask);
+ return new VmPolicy(mMask,
+ mClassInstanceLimit != null ? mClassInstanceLimit : EMPTY_CLASS_LIMIT_MAP);
}
}
}
@@ -829,9 +896,7 @@ public final class StrictMode {
if (IS_USER_BUILD) {
setCloseGuardEnabled(false);
} else {
- sVmPolicyMask = StrictMode.DETECT_VM_CURSOR_LEAKS |
- StrictMode.DETECT_VM_CLOSABLE_LEAKS |
- StrictMode.PENALTY_DROPBOX;
+ setVmPolicy(new VmPolicy.Builder().detectAll().penaltyDropBox().build());
setCloseGuardEnabled(vmClosableObjectLeaksEnabled());
}
return true;
@@ -1289,6 +1354,7 @@ public final class StrictMode {
* @param policy the policy to put into place
*/
public static void setVmPolicy(final VmPolicy policy) {
+ sVmPolicy = policy;
sVmPolicyMask = policy.mask;
setCloseGuardEnabled(vmClosableObjectLeaksEnabled());
}
@@ -1297,7 +1363,7 @@ public final class StrictMode {
* Gets the current VM policy.
*/
public static VmPolicy getVmPolicy() {
- return new VmPolicy(sVmPolicyMask);
+ return sVmPolicy;
}
/**
@@ -1652,6 +1718,20 @@ public final class StrictMode {
}
/**
+ * @hide
+ */
+ public static void noteActivityClass(Class klass) {
+ if ((sVmPolicy.mask & DETECT_VM_ACTIVITY_LEAKS) == 0) {
+ return;
+ }
+ if (sVmPolicy.classInstanceLimit.containsKey(klass)) {
+ return;
+ }
+ // Note: capping at 2, not 1, to give some breathing room.
+ setVmPolicy(new VmPolicy.Builder(sVmPolicy).setClassInstanceLimit(klass, 2).build());
+ }
+
+ /**
* Parcelable that gets sent in Binder call headers back to callers
* to report violations that happened during a cross-process call.
*
diff --git a/core/java/android/os/storage/StorageEventListener.java b/core/java/android/os/storage/StorageEventListener.java
index d3d39d6db782..6c73d04ca85c 100644
--- a/core/java/android/os/storage/StorageEventListener.java
+++ b/core/java/android/os/storage/StorageEventListener.java
@@ -18,6 +18,8 @@ package android.os.storage;
/**
* Used for receiving notifications from the StorageManager
+ *
+ * @hide
*/
public abstract class StorageEventListener {
/**
diff --git a/core/java/android/os/storage/StorageResultCode.java b/core/java/android/os/storage/StorageResultCode.java
index 07d95df96bcf..8e7db31ef2f5 100644
--- a/core/java/android/os/storage/StorageResultCode.java
+++ b/core/java/android/os/storage/StorageResultCode.java
@@ -19,6 +19,8 @@ package android.os.storage;
/**
* Class that provides access to constants returned from StorageManager
* and lower level MountService APIs.
+ *
+ * @hide
*/
public class StorageResultCode
{
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index e869f3f8cbc5..7d37e5bdf11d 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -285,7 +285,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis
* @see #Preference(Context, AttributeSet, int)
*/
public Preference(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
+ this(context, attrs, com.android.internal.R.attr.preferenceStyle);
}
/**
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index 7a186f38d882..3883451e4b23 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -1044,10 +1044,8 @@ public abstract class PreferenceActivity extends ListActivity implements
getFragmentManager().popBackStack(BACK_STACK_PREFS,
FragmentManager.POP_BACK_STACK_INCLUSIVE);
Fragment f = Fragment.instantiate(this, fragmentName, args);
- FragmentTransaction transaction = getFragmentManager().openTransaction();
- transaction.setTransition(direction == 0 ? FragmentTransaction.TRANSIT_NONE
- : direction > 0 ? FragmentTransaction.TRANSIT_FRAGMENT_NEXT
- : FragmentTransaction.TRANSIT_FRAGMENT_PREV);
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
transaction.replace(com.android.internal.R.id.prefs, f);
transaction.commit();
}
@@ -1136,13 +1134,13 @@ public abstract class PreferenceActivity extends ListActivity implements
* the current fragment will be replaced.
*/
public void startPreferenceFragment(Fragment fragment, boolean push) {
- FragmentTransaction transaction = getFragmentManager().openTransaction();
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(com.android.internal.R.id.prefs, fragment);
if (push) {
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(BACK_STACK_PREFS);
} else {
- transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_NEXT);
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
}
transaction.commit();
}
@@ -1175,7 +1173,7 @@ public abstract class PreferenceActivity extends ListActivity implements
if (resultTo != null) {
f.setTargetFragment(resultTo, resultRequestCode);
}
- FragmentTransaction transaction = getFragmentManager().openTransaction();
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(com.android.internal.R.id.prefs, f);
if (titleRes != 0) {
transaction.setBreadCrumbTitle(titleRes);
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 5fac52510765..99b686e075d0 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -374,16 +374,18 @@ class GLES20Canvas extends HardwareCanvas {
@Override
public void translate(float dx, float dy) {
- nTranslate(mRenderer, dx, dy);
+ if (dx != 0.0f || dy != 0.0f) nTranslate(mRenderer, dx, dy);
}
private native void nTranslate(int renderer, float dx, float dy);
@Override
public void skew(float sx, float sy) {
- throw new UnsupportedOperationException();
+ nSkew(mRenderer, sx, sy);
}
+ private native void nSkew(int renderer, float sx, float sy);
+
@Override
public void rotate(float degrees) {
nRotate(mRenderer, degrees);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f05ef8c588cd..53fc0c0ff112 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -7905,7 +7905,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
+ "LAYER_TYPE_SOFTWARE or LAYER_TYPE_HARDWARE");
}
- if (layerType == mLayerType) return;
+ if (layerType == mLayerType) {
+ if (layerType != LAYER_TYPE_NONE && paint != mLayerPaint) {
+ mLayerPaint = paint == null ? new Paint() : paint;
+ if (mParent instanceof ViewGroup) {
+ ((ViewGroup) mParent).invalidate();
+ }
+ invalidate();
+ }
+ return;
+ }
// Destroy any previous software drawing cache if needed
switch (mLayerType) {
@@ -7931,9 +7940,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
}
mLayerType = layerType;
- mLayerPaint = mLayerType == LAYER_TYPE_NONE ? null : paint;
+ mLayerPaint = mLayerType == LAYER_TYPE_NONE ? null : (paint == null ? new Paint() : paint);
- // TODO: Make sure we invalidate the parent's display list
+ if (mParent instanceof ViewGroup) {
+ ((ViewGroup) mParent).invalidate();
+ }
invalidate();
}
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index f6b6778ea555..d1781cc0d96c 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2398,16 +2398,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
layerType != LAYER_TYPE_NONE) {
layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG;
}
- if (layerType != LAYER_TYPE_NONE && child.mLayerPaint != null) {
+ if (layerType != LAYER_TYPE_NONE) {
child.mLayerPaint.setAlpha(multipliedAlpha);
} else {
canvas.saveLayerAlpha(sx, sy, sx + cr - cl, sy + cb - ct,
multipliedAlpha, layerFlags);
- layerSaved = true;
}
} else {
// Alpha is handled by the child directly, clobber the layer's alpha
- if (layerType != LAYER_TYPE_NONE && child.mLayerPaint != null) {
+ if (layerType != LAYER_TYPE_NONE) {
child.mLayerPaint.setAlpha(255);
}
child.mPrivateFlags |= ALPHA_SET;
@@ -2433,7 +2432,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
if (hasNoCache) {
boolean layerRendered = false;
- if (!layerSaved && layerType == LAYER_TYPE_HARDWARE) {
+ if (layerType == LAYER_TYPE_HARDWARE) {
final HardwareLayer layer = child.getHardwareLayer(canvas);
if (layer != null && layer.isValid()) {
((HardwareCanvas) canvas).drawHardwareLayer(layer, 0, 0, child.mLayerPaint);
@@ -2465,7 +2464,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
child.mPrivateFlags &= ~DIRTY_MASK;
Paint cachePaint;
- if (layerType == LAYER_TYPE_NONE || child.mLayerPaint == null) {
+ if (layerType == LAYER_TYPE_NONE) {
cachePaint = mCachePaint;
if (alpha < 1.0f) {
cachePaint.setAlpha((int) (alpha * 255));
@@ -2476,9 +2475,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
} else {
cachePaint = child.mLayerPaint;
- if (alpha < 1.0f) {
- cachePaint.setAlpha((int) (alpha * 255));
- }
+ cachePaint.setAlpha((int) (alpha * 255));
}
canvas.drawBitmap(cache, 0.0f, 0.0f, cachePaint);
}
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 0670c4e620e0..2f96782b4e36 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -1629,6 +1629,11 @@ public class WebSettings {
/* package */ synchronized void setPrivateBrowsingEnabled(boolean flag) {
if (mPrivateBrowsingEnabled != flag) {
mPrivateBrowsingEnabled = flag;
+
+ // AutoFill is dependant on private browsing being enabled so
+ // reset it to take account of the new value of mPrivateBrowsingEnabled.
+ setAutoFillEnabled(mAutoFillEnabled);
+
postSync();
}
}
@@ -1644,8 +1649,10 @@ public class WebSettings {
* @hide
*/
public synchronized void setAutoFillEnabled(boolean enabled) {
- if (mAutoFillEnabled != enabled) {
- mAutoFillEnabled = enabled;
+ // AutoFill is always disabled in private browsing mode.
+ boolean autoFillEnabled = enabled && !mPrivateBrowsingEnabled;
+ if (mAutoFillEnabled != autoFillEnabled) {
+ mAutoFillEnabled = autoFillEnabled;
postSync();
}
}
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 5345879ca6df..257ed2a4011e 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -75,23 +75,23 @@ public final class WebStorage {
private Handler mHandler = null;
private Handler mUIHandler = null;
- static class Origin {
- String mOrigin = null;
- long mQuota = 0;
- long mUsage = 0;
+ public static class Origin {
+ private String mOrigin = null;
+ private long mQuota = 0;
+ private long mUsage = 0;
- public Origin(String origin, long quota, long usage) {
+ private Origin(String origin, long quota, long usage) {
mOrigin = origin;
mQuota = quota;
mUsage = usage;
}
- public Origin(String origin, long quota) {
+ private Origin(String origin, long quota) {
mOrigin = origin;
mQuota = quota;
}
- public Origin(String origin) {
+ private Origin(String origin) {
mOrigin = origin;
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index eddfffe78b3f..78d4cd2f5e3e 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1037,7 +1037,7 @@ public class WebView extends AbsoluteLayout
String host = proxyProperties.getHost();
int port = proxyProperties.getPort();
if (port != 0)
- host += ": " + port;
+ host += ":" + port;
// TODO: Handle exclusion list
// The plan is to make an AndroidProxyResolver, and handle the blacklist
@@ -6723,43 +6723,60 @@ public class WebView extends AbsoluteLayout
}
}
+ /**
+ * Returns plugin bounds if x/y in content coordinates corresponds to a
+ * plugin. Otherwise a NULL rectangle is returned.
+ */
+ Rect getPluginBounds(int x, int y) {
+ if (nativePointInNavCache(x, y, mNavSlop) && nativeCacheHitIsPlugin()) {
+ return nativeCacheHitNodeBounds();
+ } else {
+ return null;
+ }
+ }
+
/*
- * Return true if the view (Plugin) is fully visible and maximized inside
- * the WebView.
+ * Return true if the rect (e.g. plugin) is fully visible and maximized
+ * inside the WebView.
*/
- boolean isPluginFitOnScreen(ViewManager.ChildView view) {
+ boolean isRectFitOnScreen(Rect rect) {
+ final int rectWidth = rect.width();
+ final int rectHeight = rect.height();
final int viewWidth = getViewWidth();
final int viewHeight = getViewHeightWithTitle();
- float scale = Math.min((float) viewWidth / view.width, (float) viewHeight / view.height);
+ float scale = Math.min((float) viewWidth / rectWidth, (float) viewHeight / rectHeight);
scale = mZoomManager.computeScaleWithLimits(scale);
return !mZoomManager.willScaleTriggerZoom(scale)
- && contentToViewX(view.x) >= mScrollX
- && contentToViewX(view.x + view.width) <= mScrollX + viewWidth
- && contentToViewY(view.y) >= mScrollY
- && contentToViewY(view.y + view.height) <= mScrollY + viewHeight;
+ && contentToViewX(rect.left) >= mScrollX
+ && contentToViewX(rect.right) <= mScrollX + viewWidth
+ && contentToViewY(rect.top) >= mScrollY
+ && contentToViewY(rect.bottom) <= mScrollY + viewHeight;
}
/*
* Maximize and center the rectangle, specified in the document coordinate
* space, inside the WebView. If the zoom doesn't need to be changed, do an
* animated scroll to center it. If the zoom needs to be changed, find the
- * zoom center and do a smooth zoom transition.
+ * zoom center and do a smooth zoom transition. The rect is in document
+ * coordinates
*/
- void centerFitRect(int docX, int docY, int docWidth, int docHeight) {
- int viewWidth = getViewWidth();
- int viewHeight = getViewHeightWithTitle();
- float scale = Math.min((float) viewWidth / docWidth, (float) viewHeight
- / docHeight);
+ void centerFitRect(Rect rect) {
+ final int rectWidth = rect.width();
+ final int rectHeight = rect.height();
+ final int viewWidth = getViewWidth();
+ final int viewHeight = getViewHeightWithTitle();
+ float scale = Math.min((float) viewWidth / rectWidth, (float) viewHeight
+ / rectHeight);
scale = mZoomManager.computeScaleWithLimits(scale);
if (!mZoomManager.willScaleTriggerZoom(scale)) {
- pinScrollTo(contentToViewX(docX + docWidth / 2) - viewWidth / 2,
- contentToViewY(docY + docHeight / 2) - viewHeight / 2,
+ pinScrollTo(contentToViewX(rect.left + rectWidth / 2) - viewWidth / 2,
+ contentToViewY(rect.top + rectHeight / 2) - viewHeight / 2,
true, 0);
} else {
float actualScale = mZoomManager.getScale();
- float oldScreenX = docX * actualScale - mScrollX;
- float rectViewX = docX * scale;
- float rectViewWidth = docWidth * scale;
+ float oldScreenX = rect.left * actualScale - mScrollX;
+ float rectViewX = rect.left * scale;
+ float rectViewWidth = rectWidth * scale;
float newMaxWidth = mContentWidth * scale;
float newScreenX = (viewWidth - rectViewWidth) / 2;
// pin the newX to the WebView
@@ -6770,10 +6787,10 @@ public class WebView extends AbsoluteLayout
}
float zoomCenterX = (oldScreenX * scale - newScreenX * actualScale)
/ (scale - actualScale);
- float oldScreenY = docY * actualScale + getTitleHeight()
+ float oldScreenY = rect.top * actualScale + getTitleHeight()
- mScrollY;
- float rectViewY = docY * scale + getTitleHeight();
- float rectViewHeight = docHeight * scale;
+ float rectViewY = rect.top * scale + getTitleHeight();
+ float rectViewHeight = rectHeight * scale;
float newMaxHeight = mContentHeight * scale + getTitleHeight();
float newScreenY = (viewHeight - rectViewHeight) / 2;
// pin the newY to the WebView
@@ -7506,8 +7523,7 @@ public class WebView extends AbsoluteLayout
break;
case CENTER_FIT_RECT:
- Rect r = (Rect)msg.obj;
- centerFitRect(r.left, r.top, r.width(), r.height());
+ centerFitRect((Rect)msg.obj);
break;
case SET_SCROLLBAR_MODES:
@@ -8150,6 +8166,7 @@ public class WebView extends AbsoluteLayout
}
private native int nativeCacheHitFramePointer();
+ private native boolean nativeCacheHitIsPlugin();
private native Rect nativeCacheHitNodeBounds();
private native int nativeCacheHitNodePointer();
/* package */ native void nativeClearCursor();
diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java
index b4a33de232c3..88a54ea06d70 100644
--- a/core/java/android/webkit/ZoomManager.java
+++ b/core/java/android/webkit/ZoomManager.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Canvas;
import android.graphics.Point;
+import android.graphics.Rect;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
@@ -551,12 +552,12 @@ class ZoomManager {
* If the double tap was on a plugin then either zoom to maximize the
* plugin on the screen or scale to overview mode.
*/
- ViewManager.ChildView plugin = mWebView.mViewManager.hitTest(mAnchorX, mAnchorY);
- if (plugin != null) {
- if (mWebView.isPluginFitOnScreen(plugin)) {
+ Rect pluginBounds = mWebView.getPluginBounds(mAnchorX, mAnchorY);
+ if (pluginBounds != null) {
+ if (mWebView.isRectFitOnScreen(pluginBounds)) {
zoomToOverview();
} else {
- mWebView.centerFitRect(plugin.x, plugin.y, plugin.width, plugin.height);
+ mWebView.centerFitRect(pluginBounds);
}
return;
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 7631df49e6bb..d8f597207dac 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2642,6 +2642,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
setPressed(true);
layoutChildren();
positionSelector(mMotionPosition, child);
+ refreshDrawableState();
final int longPressTimeout = ViewConfiguration.getLongPressTimeout();
final boolean longClickable = isLongClickable();
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index dbcf1e90cfd6..2c530050e736 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -46,8 +46,8 @@ import java.util.TimeZone;
* displayed. Also the minimal and maximal date from which dates to be selected
* can be customized.
* <p>
- * See the <a href="{@docRoot}
- * resources/tutorials/views/hello-datepicker.html">Date Picker tutorial</a>.
+ * See the <a href="{@docRoot}resources/tutorials/views/hello-datepicker.html">Date
+ * Picker tutorial</a>.
* </p>
* <p>
* For a dialog using this view, see {@link android.app.DatePickerDialog}.
@@ -471,6 +471,8 @@ public class DatePicker extends FrameLayout {
*/
public void init(int year, int monthOfYear, int dayOfMonth,
OnDateChangedListener onDateChangedListener) {
+ // make sure there is no callback
+ mOnDateChangedListener = null;
updateDate(year, monthOfYear, dayOfMonth);
// register the callback after updating the date
mOnDateChangedListener = onDateChangedListener;
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index 472a33521b53..8279ee5e9ccd 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -211,7 +211,7 @@ public class ExpandableListView extends ListView {
.getDimensionPixelSize(com.android.internal.R.styleable.ExpandableListView_indicatorLeft, 0);
mIndicatorRight = a
.getDimensionPixelSize(com.android.internal.R.styleable.ExpandableListView_indicatorRight, 0);
- if (mIndicatorRight == 0) {
+ if (mIndicatorRight == 0 && mGroupIndicator != null) {
mIndicatorRight = mIndicatorLeft + mGroupIndicator.getIntrinsicWidth();
}
mChildIndicatorLeft = a.getDimensionPixelSize(
@@ -1022,8 +1022,11 @@ public class ExpandableListView extends ListView {
*/
public void setGroupIndicator(Drawable groupIndicator) {
mGroupIndicator = groupIndicator;
+ if (mIndicatorRight == 0 && mGroupIndicator != null) {
+ mIndicatorRight = mIndicatorLeft + mGroupIndicator.getIntrinsicWidth();
+ }
}
-
+
/**
* Sets the drawing bounds for the indicators (at minimum, the group indicator
* is affected by this; the child indicator is affected by this if the
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index ba46a3f3b9ff..63dbfbfc0352 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -754,7 +754,7 @@ public class NumberPicker extends LinearLayout {
return;
}
mCurrentScrollOffset += y;
- while (mCurrentScrollOffset - mInitialScrollOffset > mSelectorElementHeight) {
+ while (mCurrentScrollOffset - mInitialScrollOffset >= mSelectorElementHeight) {
mCurrentScrollOffset -= mSelectorElementHeight;
decrementSelectorIndices(selectorIndices);
changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
@@ -762,7 +762,7 @@ public class NumberPicker extends LinearLayout {
mCurrentScrollOffset = mInitialScrollOffset;
}
}
- while (mCurrentScrollOffset - mInitialScrollOffset < -mSelectorElementHeight) {
+ while (mCurrentScrollOffset - mInitialScrollOffset <= -mSelectorElementHeight) {
mCurrentScrollOffset += mSelectorElementHeight;
incrementScrollSelectorIndices(selectorIndices);
changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
@@ -1147,8 +1147,8 @@ public class NumberPicker extends LinearLayout {
postAdjustScrollerCommand(0);
tryNotifyScrollListener(OnScrollListener.SCROLL_STATE_IDLE);
} else {
- showInputControls();
updateInputTextView();
+ showInputControls();
}
}
@@ -1537,8 +1537,8 @@ public class NumberPicker extends LinearLayout {
public void run() {
mPreviousScrollerY = 0;
if (mInitialScrollOffset == mCurrentScrollOffset) {
- showInputControls();
updateInputTextView();
+ showInputControls();
return;
}
// adjust to the closest value
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 24165aa7f344..8f2531172c4a 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -796,18 +796,21 @@ public class RemoteViews implements Parcelable, Filter {
if (this.value != null) {
final Bitmap b = (Bitmap) this.value;
final Bitmap.Config c = b.getConfig();
+ // If we don't know, be pessimistic and assume 4
int bpp = 4;
- switch (c) {
- case ALPHA_8:
- bpp = 1;
- break;
- case RGB_565:
- case ARGB_4444:
- bpp = 2;
- break;
- case ARGB_8888:
- bpp = 4;
- break;
+ if (c != null) {
+ switch (c) {
+ case ALPHA_8:
+ bpp = 1;
+ break;
+ case RGB_565:
+ case ARGB_4444:
+ bpp = 2;
+ break;
+ case ARGB_8888:
+ bpp = 4;
+ break;
+ }
}
counter.bitmapIncrement(b.getWidth() * b.getHeight() * bpp);
}
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index df1f4bf12dce..ab69725de790 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -33,8 +33,8 @@ import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.MeasureSpec;
import android.view.ViewGroup;
+import android.view.View.MeasureSpec;
import com.android.internal.widget.IRemoteViewsFactory;
@@ -760,11 +760,12 @@ public class RemoteViewsAdapter extends BaseAdapter {
synchronized (mCache) {
// Queue up other indices to be preloaded based on this position
mCache.queuePositionsToBePreloadedFromRequestedPosition(position);
-
- RemoteViewsFrameLayout layout = (RemoteViewsFrameLayout) convertView;
View convertViewChild = null;
int convertViewTypeId = 0;
- if (convertView != null) {
+ RemoteViewsFrameLayout layout = null;
+
+ if (convertView instanceof RemoteViewsFrameLayout) {
+ layout = (RemoteViewsFrameLayout) convertView;
convertViewChild = layout.getChildAt(0);
convertViewTypeId = getConvertViewTypeId(convertViewChild);
}
@@ -777,17 +778,17 @@ public class RemoteViewsAdapter extends BaseAdapter {
int typeId = mCache.getMetaDataAt(position).typeId;
// Reuse the convert view where possible
- if (convertView != null) {
+ if (layout != null) {
if (convertViewTypeId == typeId) {
rv.reapply(context, convertViewChild);
- return convertView;
+ return layout;
}
}
// Otherwise, create a new view to be returned
View newView = rv.apply(context, parent);
newView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(typeId));
- if (convertView != null) {
+ if (layout != null) {
layout.removeAllViews();
} else {
layout = new RemoteViewsFrameLayout(context);
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index 010262823109..0baddcb97501 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -23,6 +23,8 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
+import android.graphics.drawable.Drawable;
+import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.Gravity;
@@ -632,7 +634,8 @@ public class Spinner extends AbsSpinner implements OnClickListener {
private class DropdownPopup extends ListPopupWindow implements SpinnerPopup {
private CharSequence mHintText;
private int mPopupMaxWidth;
-
+ private Rect mTempRect = new Rect();
+
public DropdownPopup(Context context, AttributeSet attrs, int defStyleRes) {
super(context, attrs, 0, defStyleRes);
@@ -699,6 +702,14 @@ public class Spinner extends AbsSpinner implements OnClickListener {
itemView.measure(widthMeasureSpec, heightMeasureSpec);
width = Math.max(width, itemView.getMeasuredWidth());
}
+
+ // Add background padding to measured width
+ Drawable popupBackground = getBackground();
+ if (popupBackground != null) {
+ popupBackground.getPadding(mTempRect);
+ width += mTempRect.left + mTempRect.right;
+ }
+
return width;
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 623cd4180c3d..1895d793de13 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7931,9 +7931,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
max = Math.max(0, Math.max(selStart, selEnd));
}
- ClipboardManager clipboard = (ClipboardManager)getContext()
- .getSystemService(Context.CLIPBOARD_SERVICE);
-
switch (id) {
case ID_COPY_URL:
URLSpan[] urls = ((Spanned) mText).getSpans(min, max, URLSpan.class);
@@ -7942,7 +7939,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
for (int i=0; i<urls.length; i++) {
Uri uri = Uri.parse(urls[0].getURL());
if (clip == null) {
- clip = ClipData.newRawUri(null, null, uri);
+ clip = ClipData.newRawUri(null, uri);
} else {
clip.addItem(new ClipData.Item(uri));
}
@@ -7976,15 +7973,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return true;
case ID_CUT:
- setPrimaryClip(ClipData.newPlainText(null, null,
- mTransformed.subSequence(min, max)));
+ setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
((Editable) mText).delete(min, max);
stopSelectionActionMode();
return true;
case ID_COPY:
- setPrimaryClip(ClipData.newPlainText(null, null,
- mTransformed.subSequence(min, max)));
+ setPrimaryClip(ClipData.newPlainText(null, mTransformed.subSequence(min, max)));
stopSelectionActionMode();
return true;
}
@@ -8105,7 +8100,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
final int start = getSelectionStart();
final int end = getSelectionEnd();
CharSequence selectedText = mTransformed.subSequence(start, end);
- ClipData data = ClipData.newPlainText(null, null, selectedText);
+ ClipData data = ClipData.newPlainText(null, selectedText);
DragLocalState localState = new DragLocalState(this, start, end);
startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0);
stopSelectionActionMode();
@@ -8257,7 +8252,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (clip != null) {
boolean didfirst = false;
for (int i=0; i<clip.getItemCount(); i++) {
- CharSequence paste = clip.getItem(i).coerceToText(getContext());
+ CharSequence paste = clip.getItemAt(i).coerceToText(getContext());
if (paste != null) {
if (!didfirst) {
long minMax = prepareSpacesAroundPaste(min, max, paste);
@@ -8404,8 +8399,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*/
public void updatePosition(HandleView handle, int x, int y);
+ public void updateOffset(HandleView handle, int offset);
+
public void updatePosition();
+ public int getCurrentOffset(HandleView handle);
+
/**
* This method is called by {@link #onTouchEvent(MotionEvent)} and gives the controller
* a chance to become active and/or visible.
@@ -8422,7 +8421,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
private class PastePopupMenu implements OnClickListener {
- private PopupWindow mContainer;
+ private final PopupWindow mContainer;
private int mPositionX;
private int mPositionY;
private View mPasteView, mNoPasteView;
@@ -8521,12 +8520,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
private class HandleView extends View {
- private boolean mPositionOnTop = false;
private Drawable mDrawable;
- private PopupWindow mContainer;
+ private final PopupWindow mContainer;
private int mPositionX;
private int mPositionY;
- private CursorController mController;
+ private final CursorController mController;
private boolean mIsDragging;
private float mTouchToWindowOffsetX;
private float mTouchToWindowOffsetY;
@@ -8543,6 +8541,46 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
private PastePopupMenu mPastePopupWindow;
private Runnable mLongPressCallback;
+ // Touch-up filter: number of previous positions remembered
+ private static final int HISTORY_SIZE = 5;
+ private static final int TOUCH_UP_FILTER_DELAY = 150;
+ private final long[] mPreviousOffsetsTimes = new long[HISTORY_SIZE];
+ private final int[] mPreviousOffsets = new int[HISTORY_SIZE];
+ private int mPreviousOffsetIndex = 0;
+ private int mNumberPreviousOffsets = 0;
+
+ public void startTouchUpFilter(int offset) {
+ mNumberPreviousOffsets = 0;
+ addPositionToTouchUpFilter(offset);
+ }
+
+ public void addPositionToTouchUpFilter(int offset) {
+ if (mNumberPreviousOffsets > 0 &&
+ mPreviousOffsets[mPreviousOffsetIndex] == offset) {
+ // Make sure only actual changes of position are recorded.
+ return;
+ }
+
+ mPreviousOffsetIndex = (mPreviousOffsetIndex + 1) % HISTORY_SIZE;
+ mPreviousOffsets[mPreviousOffsetIndex] = offset;
+ mPreviousOffsetsTimes[mPreviousOffsetIndex] = SystemClock.uptimeMillis();
+ mNumberPreviousOffsets++;
+ }
+
+ public void filterOnTouchUp() {
+ final long now = SystemClock.uptimeMillis();
+ int i = 0;
+ int index = 0;
+ final int iMax = Math.min(mNumberPreviousOffsets, HISTORY_SIZE);
+ while (i < iMax) {
+ index = (mPreviousOffsetIndex - i + HISTORY_SIZE) % HISTORY_SIZE;
+ if ((now - mPreviousOffsetsTimes[index]) >= TOUCH_UP_FILTER_DELAY) break;
+ i++;
+ }
+
+ mController.updateOffset(this, mPreviousOffsets[index]);
+ }
+
public static final int LEFT = 0;
public static final int CENTER = 1;
public static final int RIGHT = 2;
@@ -8738,20 +8776,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
@Override
protected void onDraw(Canvas c) {
mDrawable.setBounds(0, 0, mRight - mLeft, mBottom - mTop);
- if (mPositionOnTop) {
- c.save();
- c.rotate(180, (mRight - mLeft) / 2, (mBottom - mTop) / 2);
- mDrawable.draw(c);
- c.restore();
- } else {
- mDrawable.draw(c);
- }
+ mDrawable.draw(c);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
+ startTouchUpFilter(mController.getCurrentOffset(this));
mDownPositionX = ev.getRawX();
mDownPositionY = ev.getRawY();
mTouchToWindowOffsetX = mDownPositionX - mPositionX;
@@ -8808,6 +8840,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
}
}
+ filterOnTouchUp();
mIsDragging = false;
break;
@@ -8825,6 +8858,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
void positionAtCursor(final int offset, boolean bottom) {
+ addPositionToTouchUpFilter(offset);
final int width = mDrawable.getIntrinsicWidth();
final int height = mDrawable.getIntrinsicHeight();
final int line = mLayout.getLineForOffset(offset);
@@ -8940,12 +8974,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
int offset = getHysteresisOffset(x, y, previousOffset);
if (offset != previousOffset) {
- Selection.setSelection((Spannable) mText, offset);
- updatePosition();
+ updateOffset(handle, offset);
}
hideDelayed();
}
+ public void updateOffset(HandleView handle, int offset) {
+ Selection.setSelection((Spannable) mText, offset);
+ updatePosition();
+ }
+
public void updatePosition() {
final int offset = getSelectionStart();
@@ -8959,6 +8997,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
getHandle().positionAtCursor(offset, true);
}
+ public int getCurrentOffset(HandleView handle) {
+ return getSelectionStart();
+ }
+
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
@@ -9069,6 +9111,20 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
updatePosition();
}
+ public void updateOffset(HandleView handle, int offset) {
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+
+ if (mStartHandle == handle) {
+ start = offset;
+ } else {
+ end = offset;
+ }
+
+ Selection.setSelection((Spannable) mText, start, end);
+ updatePosition();
+ }
+
public void updatePosition() {
if (!isShowing()) {
return;
@@ -9089,6 +9145,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
mEndHandle.positionAtCursor(selectionEnd, true);
}
+ public int getCurrentOffset(HandleView handle) {
+ return mStartHandle == handle ? getSelectionStart() : getSelectionEnd();
+ }
+
public boolean onTouchEvent(MotionEvent event) {
// This is done even when the View does not have focus, so that long presses can start
// selection and tap can move cursor from this tap position.
@@ -9300,7 +9360,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
ClipData clipData = event.getClipData();
final int itemCount = clipData.getItemCount();
for (int i=0; i < itemCount; i++) {
- Item item = clipData.getItem(i);
+ Item item = clipData.getItemAt(i);
content.append(item.coerceToText(TextView.this.mContext));
}
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 4ee3083887ac..0e31feff27f5 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -492,7 +492,7 @@ public class ActionBarImpl extends ActionBar {
return;
}
- final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction()
+ final FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction()
.disallowAddToBackStack();
if (mSelectedTab == tab) {
diff --git a/core/java/com/android/internal/view/menu/MenuBuilder.java b/core/java/com/android/internal/view/menu/MenuBuilder.java
index 588b10c2d066..ff59950017c9 100644
--- a/core/java/com/android/internal/view/menu/MenuBuilder.java
+++ b/core/java/com/android/internal/view/menu/MenuBuilder.java
@@ -1050,7 +1050,7 @@ public class MenuBuilder implements Menu {
*/
private ViewGroup getMeasureActionButtonParent() {
if (mMeasureActionButtonParent == null) {
- mMeasureActionButtonParent = (ViewGroup) mMenuTypes[TYPE_ACTION_BUTTON].getInflater()
+ mMeasureActionButtonParent = (ViewGroup) getMenuType(TYPE_ACTION_BUTTON).getInflater()
.inflate(LAYOUT_RES_FOR_TYPE[TYPE_ACTION_BUTTON], null, false);
}
return mMeasureActionButtonParent;
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 23f89f14c0aa..31e7bab76174 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -26,7 +26,6 @@ import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.View;
@@ -39,6 +38,8 @@ import android.widget.TextView;
* @hide
*/
public class ActionBarContextView extends ViewGroup implements AnimatorListener {
+ private static final String TAG = "ActionBarContextView";
+
private int mContentHeight;
private CharSequence mTitle;
@@ -447,7 +448,7 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
@Override
public void onAnimationEnd(Animator animation) {
- if (mAnimationMode == ANIMATE_OUT) {
+ if (mAnimationMode != ANIMATE_IN) {
killMode();
}
mAnimationMode = ANIMATE_IDLE;
diff --git a/core/java/com/android/internal/widget/WaveView.java b/core/java/com/android/internal/widget/WaveView.java
index 4cb3966aa2a1..c7a90c40bd63 100644
--- a/core/java/com/android/internal/widget/WaveView.java
+++ b/core/java/com/android/internal/widget/WaveView.java
@@ -152,7 +152,6 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mUnlockRing.setScaleX(0.1f);
mUnlockRing.setScaleY(0.1f);
mUnlockRing.setAlpha(0.0f);
-
mDrawables.add(mUnlockRing);
mUnlockDefault = new DrawableHolder(createDrawable(R.drawable.unlock_default));
@@ -192,7 +191,6 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
if (DBG) Log.v(TAG, "State RESET_LOCK");
mWaveTimerDelay = WAVE_DELAY;
for (int i = 0; i < mLightWaves.size(); i++) {
- //TweenMax.to(mLightWave.get(i), .3, {alpha:0, ease:Quint.easeOut});
DrawableHolder holder = mLightWaves.get(i);
holder.addAnimTo(300, 0, "alpha", 0.0f, false);
}
@@ -200,16 +198,12 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mLightWaves.get(i).startAnimations(this);
}
- //TweenMax.to(unlockRing, .5, { x: lockX, y: lockY, scaleX: .1, scaleY: .1,
- // alpha: 0, overwrite: true, ease:Quint.easeOut });
mUnlockRing.addAnimTo(DURATION, 0, "x", mLockCenterX, true);
mUnlockRing.addAnimTo(DURATION, 0, "y", mLockCenterY, true);
mUnlockRing.addAnimTo(DURATION, 0, "scaleX", 0.1f, true);
mUnlockRing.addAnimTo(DURATION, 0, "scaleY", 0.1f, true);
mUnlockRing.addAnimTo(DURATION, 0, "alpha", 0.0f, true);
- //TweenMax.to(unlockDefault, 0, { x: lockX, y: lockY, scaleX: .1, scaleY: .1,
- // alpha: 0 , overwrite: true });
mUnlockDefault.removeAnimationFor("x");
mUnlockDefault.removeAnimationFor("y");
mUnlockDefault.removeAnimationFor("scaleX");
@@ -220,15 +214,10 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mUnlockDefault.setScaleX(0.1f);
mUnlockDefault.setScaleY(0.1f);
mUnlockDefault.setAlpha(0.0f);
-
- //TweenMax.to(unlockDefault, .5, { delay: .1, scaleX: 1, scaleY: 1,
- // alpha: 1, overwrite: true, ease:Quint.easeOut });
mUnlockDefault.addAnimTo(DURATION, SHORT_DELAY, "scaleX", 1.0f, true);
mUnlockDefault.addAnimTo(DURATION, SHORT_DELAY, "scaleY", 1.0f, true);
mUnlockDefault.addAnimTo(DURATION, SHORT_DELAY, "alpha", 1.0f, true);
- //TweenMax.to(unlockHalo, 0, { x: lockX, y: lockY, scaleX:.1, scaleY: .1,
- // alpha: 0 , overwrite: true });
mUnlockHalo.removeAnimationFor("x");
mUnlockHalo.removeAnimationFor("y");
mUnlockHalo.removeAnimationFor("scaleX");
@@ -239,16 +228,12 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mUnlockHalo.setScaleX(0.1f);
mUnlockHalo.setScaleY(0.1f);
mUnlockHalo.setAlpha(0.0f);
-
- //TweenMax.to(unlockHalo, .5, { x: lockX, y: lockY, scaleX: 1, scaleY: 1,
- // alpha: 1 , overwrite: true, ease:Quint.easeOut });
mUnlockHalo.addAnimTo(DURATION, SHORT_DELAY, "x", mLockCenterX, true);
mUnlockHalo.addAnimTo(DURATION, SHORT_DELAY, "y", mLockCenterY, true);
mUnlockHalo.addAnimTo(DURATION, SHORT_DELAY, "scaleX", 1.0f, true);
mUnlockHalo.addAnimTo(DURATION, SHORT_DELAY, "scaleY", 1.0f, true);
mUnlockHalo.addAnimTo(DURATION, SHORT_DELAY, "alpha", 1.0f, true);
- //lockTimer.stop();
removeCallbacks(mLockTimerActions);
mLockState = STATE_READY;
@@ -260,8 +245,6 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
case STATE_START_ATTEMPT:
if (DBG) Log.v(TAG, "State START_ATTEMPT");
- //TweenMax.to(unlockDefault, 0, {scaleX: .1, scaleY:.1, alpha: 0,
- // x:lockX +182, y: lockY , overwrite: true });
mUnlockDefault.removeAnimationFor("x");
mUnlockDefault.removeAnimationFor("y");
mUnlockDefault.removeAnimationFor("scaleX");
@@ -273,14 +256,10 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mUnlockDefault.setScaleY(0.1f);
mUnlockDefault.setAlpha(0.0f);
- //TweenMax.to(unlockDefault, 0.5, { delay: .1 , scaleX: 1, scaleY: 1,
- // alpha: 1, ease:Quint.easeOut });
mUnlockDefault.addAnimTo(DURATION, SHORT_DELAY, "scaleX", 1.0f, false);
mUnlockDefault.addAnimTo(DURATION, SHORT_DELAY, "scaleY", 1.0f, false);
mUnlockDefault.addAnimTo(DURATION, SHORT_DELAY, "alpha", 1.0f, false);
- //TweenMax.to(unlockRing, 0.5, {scaleX: 1, scaleY: 1,
- // alpha: 1, ease:Quint.easeOut, overwrite: true });
mUnlockRing.addAnimTo(DURATION, 0, "scaleX", 1.0f, true);
mUnlockRing.addAnimTo(DURATION, 0, "scaleY", 1.0f, true);
mUnlockRing.addAnimTo(DURATION, 0, "alpha", 1.0f, true);
@@ -292,12 +271,8 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
case STATE_ATTEMPTING:
if (DBG) Log.v(TAG, "State ATTEMPTING (fingerDown = " + fingerDown + ")");
- //TweenMax.to(unlockHalo, 0.4, { x:mouseX, y:mouseY, scaleX:1, scaleY:1,
- // alpha: 1, ease:Quint.easeOut });
if (dragDistance > mSnapRadius) {
if (fingerDown) {
- //TweenMax.to(unlockHalo, 0.4, {x:ringX, y:ringY, scaleX:1, scaleY:1,
- // alpha: 1 , ease:Quint.easeOut , overwrite: true });
mUnlockHalo.addAnimTo(0, 0, "x", ringX, true);
mUnlockHalo.addAnimTo(0, 0, "y", ringY, true);
mUnlockHalo.addAnimTo(0, 0, "scaleX", 1.0f, true);
@@ -320,8 +295,6 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
if (DBG) Log.v(TAG, "State UNLOCK_ATTEMPT");
if (dragDistance > mSnapRadius) {
for (int n = 0; n < mLightWaves.size(); n++) {
- //TweenMax.to(this["lightWave"+n], .5,{alpha:0, delay: (6+n-currentWave)*.1,
- // x:ringX, y:ringY, scaleX: .1, scaleY: .1, ease:Quint.easeOut});
DrawableHolder wave = mLightWaves.get(n);
long delay = 1000L*(6 + n - mCurrentWave)/10L;
wave.addAnimTo(FINAL_DURATION, delay, "x", ringX, true);
@@ -334,19 +307,14 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mLightWaves.get(i).startAnimations(this);
}
- //TweenMax.to(unlockRing, .5, {x:ringX, y: ringY, scaleX: .1, scaleY: .1,
- // alpha: 0, ease: Quint.easeOut });
mUnlockRing.addAnimTo(FINAL_DURATION, 0, "x", ringX, false);
mUnlockRing.addAnimTo(FINAL_DURATION, 0, "y", ringY, false);
mUnlockRing.addAnimTo(FINAL_DURATION, 0, "scaleX", 0.1f, false);
mUnlockRing.addAnimTo(FINAL_DURATION, 0, "scaleY", 0.1f, false);
mUnlockRing.addAnimTo(FINAL_DURATION, 0, "alpha", 0.0f, false);
- //TweenMax.to(unlockRing, .5, { delay: 1.3, alpha: 0 , ease: Quint.easeOut });
mUnlockRing.addAnimTo(FINAL_DURATION, FINAL_DELAY, "alpha", 0.0f, false);
- //TweenMax.to(unlockDefault, 0, { x:ringX, y: ringY, scaleX: .1, scaleY: .1,
- // alpha: 0 , overwrite: true });
mUnlockDefault.removeAnimationFor("x");
mUnlockDefault.removeAnimationFor("y");
mUnlockDefault.removeAnimationFor("scaleX");
@@ -358,26 +326,19 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
mUnlockDefault.setScaleY(0.1f);
mUnlockDefault.setAlpha(0.0f);
- //TweenMax.to(unlockDefault, .5, { x:ringX, y: ringY, scaleX: 1, scaleY: 1,
- // alpha: 1 , ease: Quint.easeOut , overwrite: true });
mUnlockDefault.addAnimTo(FINAL_DURATION, 0, "x", ringX, true);
mUnlockDefault.addAnimTo(FINAL_DURATION, 0, "y", ringY, true);
mUnlockDefault.addAnimTo(FINAL_DURATION, 0, "scaleX", 1.0f, true);
mUnlockDefault.addAnimTo(FINAL_DURATION, 0, "scaleY", 1.0f, true);
mUnlockDefault.addAnimTo(FINAL_DURATION, 0, "alpha", 1.0f, true);
- //TweenMax.to(unlockDefault, .5, { delay: 1.3, scaleX: 3, scaleY: 3,
- // alpha: 1, ease: Quint.easeOut });
mUnlockDefault.addAnimTo(FINAL_DURATION, FINAL_DELAY, "scaleX", 3.0f, false);
mUnlockDefault.addAnimTo(FINAL_DURATION, FINAL_DELAY, "scaleY", 3.0f, false);
mUnlockDefault.addAnimTo(FINAL_DURATION, FINAL_DELAY, "alpha", 0.0f, false);
- //TweenMax.to(unlockHalo, .5, { x:ringX, y: ringY , ease: Back.easeOut });
mUnlockHalo.addAnimTo(FINAL_DURATION, 0, "x", ringX, false);
mUnlockHalo.addAnimTo(FINAL_DURATION, 0, "y", ringY, false);
- //TweenMax.to(unlockHalo, .5, { delay: 1.3, scaleX: 3, scaleY: 3,
- // alpha: 1, ease: Quint.easeOut });
mUnlockHalo.addAnimTo(FINAL_DURATION, FINAL_DELAY, "scaleX", 3.0f, false);
mUnlockHalo.addAnimTo(FINAL_DURATION, FINAL_DELAY, "scaleY", 3.0f, false);
mUnlockHalo.addAnimTo(FINAL_DURATION, FINAL_DELAY, "alpha", 0.0f, false);
@@ -429,10 +390,12 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
if (DBG) Log.v(TAG, "LockTimerActions");
// reset lock after inactivity
if (mLockState == STATE_ATTEMPTING) {
+ if (DBG) Log.v(TAG, "Timer resets to STATE_RESET_LOCK");
mLockState = STATE_RESET_LOCK;
}
// for prototype, reset after successful unlock
if (mLockState == STATE_UNLOCK_SUCCESS) {
+ if (DBG) Log.v(TAG, "Timer resets to STATE_RESET_LOCK after success");
mLockState = STATE_RESET_LOCK;
}
invalidate();
@@ -455,16 +418,12 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
wave.setX(mMouseX);
wave.setY(mMouseY);
- //TweenMax.to(this["lightWave"+currentWave], 2, { x:lockX , y:lockY, alpha: 1.5,
- // scaleX: 1, scaleY:1, ease:Cubic.easeOut});
wave.addAnimTo(WAVE_DURATION, 0, "x", mLockCenterX, true);
wave.addAnimTo(WAVE_DURATION, 0, "y", mLockCenterY, true);
wave.addAnimTo(WAVE_DURATION*2/3, 0, "alpha", 1.0f, true);
wave.addAnimTo(WAVE_DURATION, 0, "scaleX", 1.0f, true);
wave.addAnimTo(WAVE_DURATION, 0, "scaleY", 1.0f, true);
- //TweenMax.to(this["lightWave"+currentWave], 1, { delay: 1.3
- // , alpha: 0 , ease:Quint.easeOut});
wave.addAnimTo(1000, RING_DELAY, "alpha", 0.0f, false);
wave.startAnimations(WaveView.this);
@@ -603,6 +562,8 @@ public class WaveView extends View implements ValueAnimator.AnimatorUpdateListen
}
public void reset() {
+ if (DBG) Log.v(TAG, "reset() : resets state to STATE_RESET_LOCK");
mLockState = STATE_RESET_LOCK;
+ invalidate();
}
}
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index dac748dcc028..491a3884bf51 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -23,6 +23,7 @@ jclass gOptions_class;
jfieldID gOptions_justBoundsFieldID;
jfieldID gOptions_sampleSizeFieldID;
jfieldID gOptions_configFieldID;
+jfieldID gOptions_mutableFieldID;
jfieldID gOptions_ditherFieldID;
jfieldID gOptions_purgeableFieldID;
jfieldID gOptions_shareableFieldID;
@@ -179,6 +180,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
SkImageDecoder::Mode mode = SkImageDecoder::kDecodePixels_Mode;
SkBitmap::Config prefConfig = SkBitmap::kNo_Config;
bool doDither = true;
+ bool isMutable = false;
bool isPurgeable = forcePurgeable ||
(allowPurgeable && optionsPurgeable(env, options));
bool preferQualityOverSpeed = false;
@@ -196,6 +198,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
jobject jconfig = env->GetObjectField(options, gOptions_configFieldID);
prefConfig = GraphicsJNI::getNativeBitmapConfig(env, jconfig);
+ isMutable = env->GetBooleanField(options, gOptions_mutableFieldID);
doDither = env->GetBooleanField(options, gOptions_ditherFieldID);
preferQualityOverSpeed = env->GetBooleanField(options,
gOptions_preferQualityOverSpeedFieldID);
@@ -306,15 +309,19 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
// already have a pixelref installed.
pr = bitmap->pixelRef();
}
- // promise we will never change our pixels (great for sharing and pictures)
- pr->setImmutable();
+
+ if (!isMutable) {
+ // promise we will never change our pixels (great for sharing and pictures)
+ pr->setImmutable();
+ }
if (javaBitmap != NULL) {
// If a java bitmap was passed in for reuse, pass it back
return javaBitmap;
}
// now create the java bitmap
- return GraphicsJNI::createBitmap(env, bitmap, javaAllocator.getStorageObj(), false, ninePatchChunk);
+ return GraphicsJNI::createBitmap(env, bitmap, javaAllocator.getStorageObj(),
+ isMutable, ninePatchChunk);
}
static jobject nativeDecodeStream(JNIEnv* env, jobject clazz,
@@ -510,6 +517,11 @@ static void nativeSetDefaultConfig(JNIEnv* env, jobject, int nativeConfig) {
}
}
+static jboolean nativeIsSeekable(JNIEnv* env, jobject, jobject fileDescriptor) {
+ jint descriptor = env->GetIntField(fileDescriptor, gFileDescriptor_descriptor);
+ return ::lseek64(descriptor, 0, SEEK_CUR) != -1 ? JNI_TRUE : JNI_FALSE;
+}
+
///////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gMethods[] = {
@@ -539,6 +551,11 @@ static JNINativeMethod gMethods[] = {
},
{ "nativeSetDefaultConfig", "(I)V", (void*)nativeSetDefaultConfig },
+
+ { "nativeIsSeekable",
+ "(Ljava/io/FileDescriptor;)Z",
+ (void*)nativeIsSeekable
+ },
};
static JNINativeMethod gOptionsMethods[] = {
@@ -572,6 +589,7 @@ int register_android_graphics_BitmapFactory(JNIEnv* env) {
gOptions_sampleSizeFieldID = getFieldIDCheck(env, gOptions_class, "inSampleSize", "I");
gOptions_configFieldID = getFieldIDCheck(env, gOptions_class, "inPreferredConfig",
"Landroid/graphics/Bitmap$Config;");
+ gOptions_mutableFieldID = getFieldIDCheck(env, gOptions_class, "inMutable", "Z");
gOptions_ditherFieldID = getFieldIDCheck(env, gOptions_class, "inDither", "Z");
gOptions_purgeableFieldID = getFieldIDCheck(env, gOptions_class, "inPurgeable", "Z");
gOptions_shareableFieldID = getFieldIDCheck(env, gOptions_class, "inInputShareable", "Z");
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 40cec3e38b23..ac491ea25a5e 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -213,6 +213,11 @@ static void android_view_GLES20Canvas_scale(JNIEnv* env, jobject canvas,
renderer->scale(sx, sy);
}
+static void android_view_GLES20Canvas_skew(JNIEnv* env, jobject canvas,
+ OpenGLRenderer* renderer, jfloat sx, jfloat sy) {
+ renderer->skew(sx, sy);
+}
+
static void android_view_GLES20Canvas_setMatrix(JNIEnv* env, jobject canvas,
OpenGLRenderer* renderer, SkMatrix* matrix) {
renderer->setMatrix(matrix);
@@ -550,6 +555,7 @@ static JNINativeMethod gMethods[] = {
{ "nTranslate", "(IFF)V", (void*) android_view_GLES20Canvas_translate },
{ "nRotate", "(IF)V", (void*) android_view_GLES20Canvas_rotate },
{ "nScale", "(IFF)V", (void*) android_view_GLES20Canvas_scale },
+ { "nSkew", "(IFF)V", (void*) android_view_GLES20Canvas_skew },
{ "nSetMatrix", "(II)V", (void*) android_view_GLES20Canvas_setMatrix },
{ "nGetMatrix", "(I)I", (void*) android_view_GLES20Canvas_getNativeMatrix },
diff --git a/core/res/res/animator/fragment_next_enter.xml b/core/res/res/animator/fragment_fade_enter.xml
index 13b15f318e46..13b15f318e46 100644
--- a/core/res/res/animator/fragment_next_enter.xml
+++ b/core/res/res/animator/fragment_fade_enter.xml
diff --git a/core/res/res/animator/fragment_next_exit.xml b/core/res/res/animator/fragment_fade_exit.xml
index 503b7ad2338a..503b7ad2338a 100644
--- a/core/res/res/animator/fragment_next_exit.xml
+++ b/core/res/res/animator/fragment_fade_exit.xml
diff --git a/core/res/res/animator/fragment_prev_enter.xml b/core/res/res/animator/fragment_prev_enter.xml
deleted file mode 100644
index 13b15f318e46..000000000000
--- a/core/res/res/animator/fragment_prev_enter.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 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.
-*/
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:zAdjustment="top">
- <objectAnimator
- android:interpolator="@interpolator/decelerate_cubic"
- android:valueFrom="0"
- android:valueTo="1"
- android:valueType="floatType"
- android:propertyName="alpha"
- android:duration="@android:integer/config_activityDefaultDur"/>
-</set> \ No newline at end of file
diff --git a/core/res/res/animator/fragment_prev_exit.xml b/core/res/res/animator/fragment_prev_exit.xml
deleted file mode 100644
index 503b7ad2338a..000000000000
--- a/core/res/res/animator/fragment_prev_exit.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 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.
-*/
--->
-<set xmlns:android="http://schemas.android.com/apk/res/android"
- android:zAdjustment="normal">
- <objectAnimator
- android:interpolator="@interpolator/decelerate_cubic"
- android:valueFrom="1"
- android:valueTo="0"
- android:valueType="floatType"
- android:propertyName="alpha"
- android:duration="@android:integer/config_activityShortDur"/>
-</set> \ No newline at end of file
diff --git a/core/res/res/color/secondary_text_holo_dark.xml b/core/res/res/color/secondary_text_holo_dark.xml
index 881a1de3d0c2..7c564f777a66 100644
--- a/core/res/res/color/secondary_text_holo_dark.xml
+++ b/core/res/res/color/secondary_text_holo_dark.xml
@@ -17,11 +17,11 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="false" android:color="@android:color/dim_foreground_disabled_holo_dark"/>
<item android:state_window_focused="false" android:color="@android:color/dim_foreground_holo_dark"/>
- <item android:state_selected="true" android:state_enabled="false" android:color="@android:color/dim_foreground_inverse_disabled_holo_dark"/>
- <item android:state_pressed="true" android:state_enabled="false" android:color="@android:color/dim_foreground_inverse_disabled_holo_dark"/>
- <item android:state_selected="true" android:color="@android:color/dim_foreground_inverse_holo_dark"/>
- <item android:state_activated="true" android:color="@android:color/bright_foreground_inverse_holo_dark"/>
- <item android:state_pressed="true" android:color="@android:color/dim_foreground_inverse_holo_dark"/>
+ <item android:state_selected="true" android:state_enabled="false" android:color="@android:color/dim_foreground_disabled_holo_dark"/>
+ <item android:state_pressed="true" android:state_enabled="false" android:color="@android:color/dim_foreground_disabled_holo_dark"/>
+ <item android:state_selected="true" android:color="@android:color/dim_foreground_holo_dark"/>
+ <item android:state_activated="true" android:color="@android:color/bright_foreground_holo_dark"/>
+ <item android:state_pressed="true" android:color="@android:color/dim_foreground_holo_dark"/>
<item android:state_enabled="false" android:color="@android:color/dim_foreground_disabled_holo_dark"/>
<item android:color="@android:color/dim_foreground_holo_dark"/> <!-- not selected -->
</selector>
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_0.png b/core/res/res/drawable-hdpi/stat_sys_battery_0.png
index 3ed0105778bb..82f2509228f6 100644
--- a/core/res/res/drawable-hdpi/stat_sys_battery_0.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_0.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_10.png b/core/res/res/drawable-hdpi/stat_sys_battery_10.png
index c81616b88e68..4486553d7280 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_10.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_10.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_100.png b/core/res/res/drawable-hdpi/stat_sys_battery_100.png
index e49448d94221..e49448d94221 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_100.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_100.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_20.png b/core/res/res/drawable-hdpi/stat_sys_battery_20.png
index eb5ef09c7e20..c8f9c9231a28 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_20.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_20.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_40.png b/core/res/res/drawable-hdpi/stat_sys_battery_40.png
index 441bbfba9f03..441bbfba9f03 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_40.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_40.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_60.png b/core/res/res/drawable-hdpi/stat_sys_battery_60.png
index d9467eda963f..d9467eda963f 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_60.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_60.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_80.png b/core/res/res/drawable-hdpi/stat_sys_battery_80.png
index e3f48054a55e..e3f48054a55e 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_80.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_80.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim0.png b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim0.png
index 9a6c6839cbbf..c7464f7313dc 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim0.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim0.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim1.png b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim1.png
index c40c622e5d98..997feb36658d 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim1.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim1.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim2.png b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim2.png
index 426a66b60223..426a66b60223 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim2.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim2.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim3.png b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim3.png
index 21582ca14f4e..21582ca14f4e 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim3.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim3.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim4.png b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim4.png
index 8a94763d5915..8a94763d5915 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim4.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim4.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim5.png b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim5.png
index fad0d657a252..fad0d657a252 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim5.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_charge_anim5.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_battery_unknown.png b/core/res/res/drawable-hdpi/stat_sys_battery_unknown.png
index 1a9abaf11c16..dadfe8d701bb 100644..100755
--- a/core/res/res/drawable-hdpi/stat_sys_battery_unknown.png
+++ b/core/res/res/drawable-hdpi/stat_sys_battery_unknown.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/pointer_arrow.png b/core/res/res/drawable-mdpi/pointer_arrow.png
index e01129c1647d..fbd187c19f18 100644
--- a/core/res/res/drawable-mdpi/pointer_arrow.png
+++ b/core/res/res/drawable-mdpi/pointer_arrow.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/btn_code_lock_default.png b/core/res/res/drawable-xlarge-hdpi/btn_code_lock_default.png
new file mode 100644
index 000000000000..719eb89abd4e
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/btn_code_lock_default.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/btn_code_lock_touched.png b/core/res/res/drawable-xlarge-hdpi/btn_code_lock_touched.png
new file mode 100644
index 000000000000..719eb89abd4e
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/btn_code_lock_touched.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_green_up.png b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_green_up.png
new file mode 100644
index 000000000000..c605607222ae
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_green_up.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_red_up.png b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_red_up.png
new file mode 100644
index 000000000000..a7988635f9d0
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_drag_direction_red_up.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_default.png b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_default.png
new file mode 100644
index 000000000000..07e616502425
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_default.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_green.png b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_green.png
new file mode 100644
index 000000000000..ec178416c9f9
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_green.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_red.png b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_red.png
new file mode 100644
index 000000000000..a0cb1ecf7f45
--- /dev/null
+++ b/core/res/res/drawable-xlarge-hdpi/indicator_code_lock_point_area_red.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.png b/core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.png
index eb4e0beff0dc..45cc20dd6ddf 100644
--- a/core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.png
+++ b/core/res/res/drawable-xlarge-mdpi/btn_code_lock_default.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.png b/core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.png
index e56ae5b14ccb..45cc20dd6ddf 100644
--- a/core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.png
+++ b/core/res/res/drawable-xlarge-mdpi/btn_code_lock_touched.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_green_up.png b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_green_up.png
index 8c3e363b128a..0bc86c36a70a 100644
--- a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_green_up.png
+++ b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_green_up.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_red_up.png b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_red_up.png
index 7b3e41b1597f..2ab45477a1b8 100644
--- a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_red_up.png
+++ b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_drag_direction_red_up.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_default.png b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_default.png
index f163742bbba3..fe72d000d4bf 100644
--- a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_default.png
+++ b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_default.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_green.png b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_green.png
index 37abb2f3aec1..be666c6f553c 100644
--- a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_green.png
+++ b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_green.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_red.png b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_red.png
index c6f6fc2e72a6..962719725f26 100644
--- a/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_red.png
+++ b/core/res/res/drawable-xlarge-mdpi/indicator_code_lock_point_area_red.png
Binary files differ
diff --git a/core/res/res/layout/preference.xml b/core/res/res/layout/preference.xml
index 6bd5efafdb6c..1f92252b2d8d 100644
--- a/core/res/res/layout/preference.xml
+++ b/core/res/res/layout/preference.xml
@@ -24,36 +24,30 @@
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">
- <LinearLayout
+ <ImageView
+ android:id="@+android:id/icon"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:minWidth="@dimen/preference_widget_width"
- android:gravity="center"
- android:orientation="horizontal">
- <ImageView
- android:id="@+android:id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- />
- </LinearLayout>
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginLeft="15dip"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
-
+
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="?android:attr/textAppearanceLarge"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
-
+
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -69,8 +63,7 @@
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:minWidth="@dimen/preference_widget_width"
- android:gravity="center"
+ android:gravity="center_vertical"
android:orientation="vertical" />
</LinearLayout>
diff --git a/core/res/res/layout/preference_category.xml b/core/res/res/layout/preference_category.xml
index 7ffdc9af1f7a..280d952ac512 100644
--- a/core/res/res/layout/preference_category.xml
+++ b/core/res/res/layout/preference_category.xml
@@ -18,5 +18,4 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/listSeparatorTextViewStyle"
android:id="@+android:id/title"
- android:paddingLeft="32dp"
/>
diff --git a/core/res/res/layout/preference_category_holo.xml b/core/res/res/layout/preference_category_holo.xml
new file mode 100644
index 000000000000..5fe8b28f18bc
--- /dev/null
+++ b/core/res/res/layout/preference_category_holo.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- Layout used for PreferenceCategory in a PreferenceActivity. -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ style="?android:attr/listSeparatorTextViewStyle"
+ android:id="@+android:id/title"
+ android:paddingLeft="32dp"
+/>
diff --git a/core/res/res/layout/preference_child_holo.xml b/core/res/res/layout/preference_child_holo.xml
new file mode 100644
index 000000000000..2e70d77cdc03
--- /dev/null
+++ b/core/res/res/layout/preference_child_holo.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- Layout for a visually child-like Preference in a PreferenceActivity. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:gravity="center_vertical"
+ android:paddingLeft="16dip"
+ android:paddingRight="?android:attr/scrollbarSize">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:minWidth="@dimen/preference_widget_width"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <ImageView
+ android:id="@+android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="6dip"
+ android:layout_marginTop="6dip"
+ android:layout_marginBottom="6dip"
+ android:layout_weight="1">
+
+ <TextView android:id="@+android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal" />
+
+ <TextView android:id="@+android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignLeft="@android:id/title"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="4" />
+
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@+android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:minWidth="@dimen/preference_widget_width"
+ android:gravity="center"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/core/res/res/layout/preference_holo.xml b/core/res/res/layout/preference_holo.xml
new file mode 100644
index 000000000000..c448f6432784
--- /dev/null
+++ b/core/res/res/layout/preference_holo.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- Layout for a Preference in a PreferenceActivity. The
+ Preference is able to place a specific widget for its particular
+ type in the "widget_frame" layout. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:gravity="center_vertical"
+ android:paddingRight="?android:attr/scrollbarSize">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:minWidth="@dimen/preference_widget_width"
+ android:gravity="center"
+ android:orientation="horizontal">
+ <ImageView
+ android:id="@+android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="6dip"
+ android:layout_marginTop="6dip"
+ android:layout_marginBottom="6dip"
+ android:layout_weight="1">
+
+ <TextView android:id="@+android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal" />
+
+ <TextView android:id="@+android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignLeft="@android:id/title"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="4" />
+
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@+android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:minWidth="@dimen/preference_widget_width"
+ android:gravity="center"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/core/res/res/layout/preference_information.xml b/core/res/res/layout/preference_information.xml
index 9c9b83ebf3bb..32cbb9055301 100644
--- a/core/res/res/layout/preference_information.xml
+++ b/core/res/res/layout/preference_information.xml
@@ -24,13 +24,10 @@
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">
- <View
- android:layout_width="@dimen/preference_widget_width"
- android:layout_height="match_parent" />
-
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginLeft="16sp"
android:layout_marginRight="6sp"
android:layout_marginTop="6sp"
android:layout_marginBottom="6sp"
@@ -40,9 +37,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorSecondary" />
-
+
<TextView android:id="@+android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -53,7 +50,7 @@
android:maxLines="2" />
</RelativeLayout>
-
+
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
diff --git a/core/res/res/layout/preference_information_holo.xml b/core/res/res/layout/preference_information_holo.xml
new file mode 100644
index 000000000000..d6cc063efa3e
--- /dev/null
+++ b/core/res/res/layout/preference_information_holo.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- Layout for a Preference in a PreferenceActivity. The
+ Preference is able to place a specific widget for its particular
+ type in the "widget_frame" layout. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:gravity="center_vertical"
+ android:paddingRight="?android:attr/scrollbarSize">
+
+ <View
+ android:layout_width="@dimen/preference_widget_width"
+ android:layout_height="match_parent" />
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="6sp"
+ android:layout_marginTop="6sp"
+ android:layout_marginBottom="6sp"
+ android:layout_weight="1">
+
+ <TextView android:id="@+android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary" />
+
+ <TextView android:id="@+android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignLeft="@android:id/title"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="2" />
+
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@+android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 19e2b8d9c937..6ca42e3c85d0 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1379,10 +1379,8 @@
<attr name="fragmentOpenExitAnimation" format="reference" />
<attr name="fragmentCloseEnterAnimation" format="reference" />
<attr name="fragmentCloseExitAnimation" format="reference" />
- <attr name="fragmentNextEnterAnimation" format="reference" />
- <attr name="fragmentNextExitAnimation" format="reference" />
- <attr name="fragmentPrevEnterAnimation" format="reference" />
- <attr name="fragmentPrevExitAnimation" format="reference" />
+ <attr name="fragmentFadeEnterAnimation" format="reference" />
+ <attr name="fragmentFadeExitAnimation" format="reference" />
</declare-styleable>
<!-- Window animation class attributes. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 3ad29c4bd933..eabd4575e1c3 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1311,10 +1311,8 @@
<public type="attr" name="fragmentOpenExitAnimation" />
<public type="attr" name="fragmentCloseEnterAnimation" />
<public type="attr" name="fragmentCloseExitAnimation" />
- <public type="attr" name="fragmentNextEnterAnimation" />
- <public type="attr" name="fragmentNextExitAnimation" />
- <public type="attr" name="fragmentPrevEnterAnimation" />
- <public type="attr" name="fragmentPrevExitAnimation" />
+ <public type="attr" name="fragmentFadeEnterAnimation" />
+ <public type="attr" name="fragmentFadeExitAnimation" />
<public type="attr" name="actionBarSize" />
<public type="attr" name="imeSubtypeLocale" />
<public type="attr" name="imeSubtypeMode" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index c4e815e86ebc..16c80d0e72fd 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -85,10 +85,8 @@
<item name="fragmentOpenExitAnimation">@animator/fragment_open_exit</item>
<item name="fragmentCloseEnterAnimation">@animator/fragment_close_enter</item>
<item name="fragmentCloseExitAnimation">@animator/fragment_close_exit</item>
- <item name="fragmentNextEnterAnimation">@animator/fragment_next_enter</item>
- <item name="fragmentNextExitAnimation">@animator/fragment_next_exit</item>
- <item name="fragmentPrevEnterAnimation">@animator/fragment_prev_enter</item>
- <item name="fragmentPrevExitAnimation">@animator/fragment_prev_exit</item>
+ <item name="fragmentFadeEnterAnimation">@animator/fragment_fade_enter</item>
+ <item name="fragmentFadeExitAnimation">@animator/fragment_fade_exit</item>
</style>
<!-- Standard animations for a non-full-screen window or activity. -->
@@ -889,22 +887,66 @@
<item name="android:positiveButtonText">@android:string/ok</item>
<item name="android:negativeButtonText">@android:string/cancel</item>
</style>
-
+
<style name="Preference.DialogPreference.YesNoPreference">
<item name="android:positiveButtonText">@android:string/yes</item>
<item name="android:negativeButtonText">@android:string/no</item>
</style>
-
+
<style name="Preference.DialogPreference.EditTextPreference">
<item name="android:dialogLayout">@android:layout/preference_dialog_edittext</item>
</style>
-
+
<style name="Preference.RingtonePreference">
<item name="android:ringtoneType">ringtone</item>
<item name="android:showSilent">true</item>
<item name="android:showDefault">true</item>
</style>
+ <style name="Preference.Holo">
+ <item name="android:layout">@android:layout/preference_holo</item>
+ </style>
+
+ <style name="Preference.Holo.Information">
+ <item name="android:layout">@android:layout/preference_information_holo</item>
+ <item name="android:enabled">false</item>
+ <item name="android:shouldDisableView">false</item>
+ </style>
+
+ <style name="Preference.Holo.Category">
+ <item name="android:layout">@android:layout/preference_category_holo</item>
+ <!-- The title should not dim if the category is disabled, instead only the preference children should dim. -->
+ <item name="android:shouldDisableView">false</item>
+ <item name="android:selectable">false</item>
+ </style>
+
+ <style name="Preference.Holo.CheckBoxPreference">
+ <item name="android:widgetLayout">@android:layout/preference_widget_checkbox</item>
+ </style>
+
+ <style name="Preference.Holo.PreferenceScreen">
+ </style>
+
+ <style name="Preference.Holo.DialogPreference">
+ <item name="android:positiveButtonText">@android:string/ok</item>
+ <item name="android:negativeButtonText">@android:string/cancel</item>
+ </style>
+
+ <style name="Preference.Holo.DialogPreference.YesNoPreference">
+ <item name="android:positiveButtonText">@android:string/yes</item>
+ <item name="android:negativeButtonText">@android:string/no</item>
+ </style>
+
+ <style name="Preference.Holo.DialogPreference.EditTextPreference">
+ <item name="android:dialogLayout">@android:layout/preference_dialog_edittext</item>
+ </style>
+
+ <style name="Preference.Holo.RingtonePreference">
+ <item name="android:ringtoneType">ringtone</item>
+ <item name="android:showSilent">true</item>
+ <item name="android:showDefault">true</item>
+ </style>
+
<!-- No margins or background by default. Could be different for x-large screens -->
<style name="PreferencePanel">
</style>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 744d0d8ffef5..506dd0756998 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -924,18 +924,18 @@
<item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.Holo.QuickContactBadgeSmall.WindowLarge</item>
<item name="listPopupWindowStyle">@android:style/Widget.Holo.ListPopupWindow</item>
<item name="popupMenuStyle">@android:style/Widget.Holo.PopupMenu</item>
-
+
<!-- Preference styles -->
- <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
- <item name="preferenceCategoryStyle">@android:style/Preference.Category</item>
- <item name="preferenceStyle">@android:style/Preference</item>
- <item name="preferenceInformationStyle">@android:style/Preference.Information</item>
- <item name="checkBoxPreferenceStyle">@android:style/Preference.CheckBoxPreference</item>
- <item name="yesNoPreferenceStyle">@android:style/Preference.DialogPreference.YesNoPreference</item>
- <item name="dialogPreferenceStyle">@android:style/Preference.DialogPreference</item>
- <item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
- <item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
- <item name="preferenceLayoutChild">@android:layout/preference_child</item>
+ <item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
+ <item name="preferenceCategoryStyle">@android:style/Preference.Holo.Category</item>
+ <item name="preferenceStyle">@android:style/Preference.Holo</item>
+ <item name="preferenceInformationStyle">@android:style/Preference.Holo.Information</item>
+ <item name="checkBoxPreferenceStyle">@android:style/Preference.Holo.CheckBoxPreference</item>
+ <item name="yesNoPreferenceStyle">@android:style/Preference.Holo.DialogPreference.YesNoPreference</item>
+ <item name="dialogPreferenceStyle">@android:style/Preference.Holo.DialogPreference</item>
+ <item name="editTextPreferenceStyle">@android:style/Preference.Holo.DialogPreference.EditTextPreference</item>
+ <item name="ringtonePreferenceStyle">@android:style/Preference.Holo.RingtonePreference</item>
+ <item name="preferenceLayoutChild">@android:layout/preference_child_holo</item>
<item name="detailsElementBackground">@android:drawable/panel_bg_holo_dark</item>
<!-- Search widget styles -->
@@ -1187,16 +1187,16 @@
<item name="popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item>
<!-- Preference styles -->
- <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
- <item name="preferenceCategoryStyle">@android:style/Preference.Category</item>
- <item name="preferenceStyle">@android:style/Preference</item>
- <item name="preferenceInformationStyle">@android:style/Preference.Information</item>
- <item name="checkBoxPreferenceStyle">@android:style/Preference.CheckBoxPreference</item>
- <item name="yesNoPreferenceStyle">@android:style/Preference.DialogPreference.YesNoPreference</item>
- <item name="dialogPreferenceStyle">@android:style/Preference.DialogPreference</item>
- <item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
- <item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
- <item name="preferenceLayoutChild">@android:layout/preference_child</item>
+ <item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
+ <item name="preferenceCategoryStyle">@android:style/Preference.Holo.Category</item>
+ <item name="preferenceStyle">@android:style/Preference.Holo</item>
+ <item name="preferenceInformationStyle">@android:style/Preference.Holo.Information</item>
+ <item name="checkBoxPreferenceStyle">@android:style/Preference.Holo.CheckBoxPreference</item>
+ <item name="yesNoPreferenceStyle">@android:style/Preference.Holo.DialogPreference.YesNoPreference</item>
+ <item name="dialogPreferenceStyle">@android:style/Preference.Holo.DialogPreference</item>
+ <item name="editTextPreferenceStyle">@android:style/Preference.Holo.DialogPreference.EditTextPreference</item>
+ <item name="ringtonePreferenceStyle">@android:style/Preference.Holo.RingtonePreference</item>
+ <item name="preferenceLayoutChild">@android:layout/preference_child_holo</item>
<item name="detailsElementBackground">@android:drawable/panel_bg_holo_light</item>
<!-- Search widget styles -->
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 2126529a8485..0e65df555ec4 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -48,7 +48,6 @@ import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Arrays;
public class PackageManagerTests extends AndroidTestCase {
private static final boolean localLOGV = true;
@@ -3106,164 +3105,6 @@ public class PackageManagerTests extends AndroidTestCase {
PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
}
- @LargeTest
- public void testPackageObbPaths_Nonexistent() {
- try {
- final PackageManager pm = getPm();
-
- // Invalid Java package name.
- pm.getPackageObbPaths("=non-existent");
-
- fail("Should not be able to get package OBB paths for non-existent package");
- } catch (IllegalArgumentException e) {
- // pass
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_Initial() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- assertEquals("Initial obb paths should be null",
- null, pm.getPackageObbPaths(ip.pkg.packageName));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_Null() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- pm.setPackageObbPaths(ip.pkg.packageName, null);
-
- assertEquals("Returned paths should be null",
- null, pm.getPackageObbPaths(ip.pkg.packageName));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_Empty() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- final String[] paths = new String[0];
-
- pm.setPackageObbPaths(ip.pkg.packageName, paths);
-
- assertEquals("Empty list should be interpreted as null",
- null, pm.getPackageObbPaths(ip.pkg.packageName));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_Single() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- final String[] paths = new String[] {
- "/example/test",
- };
-
- pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
- assertTrue("Previously set paths should be the same as the returned paths.",
- Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_Multiple() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- final String[] paths = new String[] {
- "/example/test1",
- "/example/test2",
- };
-
- pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
- assertTrue("Previously set paths should be the same as the returned paths.",
- Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_Twice() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- final String[] paths = new String[] {
- "/example/test1",
- "/example/test2",
- };
-
- pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
- assertTrue("Previously set paths should be the same as the returned paths.",
- Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
-
- paths[0] = "/example/test3";
- pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
- assertTrue("Previously set paths should be the same as the returned paths.",
- Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
- @LargeTest
- public void testPackageObbPaths_ReplacePackage() {
- InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
- try {
- final PackageManager pm = getPm();
-
- final String[] paths = new String[] {
- "/example/test1",
- "/example/test2",
- };
-
- pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
- Log.i(TAG, "Creating replaceReceiver");
- final GenericReceiver receiver = new ReplaceReceiver(ip.pkg.packageName);
-
- final int flags = PackageManager.INSTALL_REPLACE_EXISTING;
- invokeInstallPackage(ip.packageURI, flags, receiver);
- assertInstall(ip.pkg, flags, ip.pkg.installLocation);
-
- assertTrue("Previously set paths should be the same as the returned paths.",
- Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
- } finally {
- cleanUpInstall(ip);
- }
- }
-
/*---------- Recommended install location tests ----*/
/*
* TODO's
diff --git a/docs/html/guide/developing/index.html b/docs/html/guide/developing/index.html
deleted file mode 100644
index 4881acf44581..000000000000
--- a/docs/html/guide/developing/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<head>
-<meta http-equiv="refresh" content="0;url=../index.html">
-</head>
-<body>
-<a href="../index.html">click here</a> if you are not redirected.
-</body>
-</html> \ No newline at end of file
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index a984acd18d39..67f1fec35e44 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -58,6 +58,9 @@
<span class="zh-TW" style="display:none">應用程式基本原理</span>
</a></li>
+ <li><a href="<?cs var:toroot ?>guide/topics/fundamentals/fragments.html">
+ <span class="en">Fragments</span>
+ </a> <span class="new">new!</span></li>
</ul>
<ul>
<li class="toggle-list">
@@ -199,9 +202,6 @@
</li>
</ul>
<ul>
- <li><a href="<?cs var:toroot ?>guide/topics/fragments/index.html">
- <span class="en">Fragments</span>
- </a> <span class="new">new!</span></li>
<li class="toggle-list">
<div><a href="<?cs var:toroot ?>guide/topics/graphics/index.html">
<span class="en">Graphics</span>
diff --git a/docs/html/guide/topics/fragments/index.jd b/docs/html/guide/topics/fragments/index.jd
deleted file mode 100644
index d07daf47a2d5..000000000000
--- a/docs/html/guide/topics/fragments/index.jd
+++ /dev/null
@@ -1,648 +0,0 @@
-page.title=Fragments
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-
- <h2>Quickview</h2>
- <ul>
- <li>Decompose application functionality and UI into reusable modules</li>
- <li>Add multiple fragments to a screen to avoid switching activities</li>
- <li>Fragments have their own lifecycle, state, and back stack</li>
- <li>Fragments require API Level HONEYCOMB or greater</li>
- </ul>
-
- <h2>In this document</h2>
- <ol>
- <li><a href="#Creating">Creating fragments</a></li>
- <li><a href="#Adding">Adding a fragment to an activity</a></li>
- <li><a href="#Managing">Managing fragments</a></li>
- <li><a href="#Lifecycle">Handling the lifecycle</a></li>
- <li><a href="#Integrating">Integrating with the activity</a></li>
- <li><a href="#Menus">Adding menus</a></li>
- </ol>
-
- <h2>Key classes</h2>
- <ol>
- <li>{@link android.app.Fragment}</li>
- <li>{@link android.app.FragmentManager}</li>
- <li>{@link android.app.FragmentTransaction}</li>
- </ol>
-
- <!--
- <h2>Related samples</h2>
- <ol>
- <li><a
-href="{@docRoot}resources/samples/NotePad/index.html">NotePad</a></li>
- </ol>
- -->
-</div>
-</div>
-
-
-<p>An {@link android.app.Activity} is always the window in which users interact with your
-application, but a {@link android.app.Fragment} can be responsible for distinct operations and UI
-that's embedded in an activity. So, when using fragments, your activity becomes more like a
-container for fragments that define the activity's behavior and UI.</p>
-
-<p>Fragments have their own
-set of lifecylce callback methods and recieve their own user input events. A fragment must always be
-embedded in an activity and the fragment's lifecycle is directly affected by the activity's
-lifecycle. For example, when the activity is stopped, so are all fragments in it, and when
-the activity is destroyed, so are all fragments. However, while an activity
-is active (in the "resumed" lifecycle stage), you can manipulate the lifecycle of each fragment
-independently. For example, you can add and remove fragments while the activity is active and you
-can add each fragment to a back stack within the activity&mdash;each back stack entry in the
-activity is actually a record of a "transaction" that occurred with the activity's fragments, so
-that the user can reverse the transaction with the BACK key (this is discussed more later).</p>
-
-<div class="figure" style="width:314px">
-<img src="{@docRoot}images/fragment_lifecycle.png" alt="" />
-<p class="img-caption"><strong>Figure 1.</strong> The lifecycle of a fragment (while its
-activity is running).</p>
-</div>
-
-<p>Android introduced fragments in Android X.X (API Level HONEYCOMB), with the primary intention to
-support more dynamic and flexible UI designs on large screen devices, such as tablets. Because a
-tablet has a much larger screen than a mobile phone, there's more room to interchange UI
-elements. Fragments allow that without the need for you to start a new activity or manage complex
-changes to the view hierarchy. By dividing the layout of an activity into fragments, the code
-that defines your activity becomes more modular and interchangable, allowing you to modify the
-activity's appearance at runtime and for different types of screens.</p>
-
-<p>For example, a news application can use one fragment to show a list of articles on the
-left and another fragment to display an article on the right&mdash;both fragments appear in one
-activity, side by side, and each fragment has its own set of lifecycle callback methods and handle
-their own user input events. Thus, instead using one activity to select an article and another
-activity to read the article, the user can select an article and read it all within the same
-activity.</p>
-
-<!-- ** TODO: Save this for later or move it down in the doc so the intro isn't overwhelming **
-
-<p>A fragment can be a modular and reusable component in your application. That is, because
-the fragment defines its own behavior using its own set of lifecycle callbacks, you can
-include one fragment in multiple activities. This also enables you to create one version of your
-application for multiple screen sizes. For instance, on an extra large screen (<em>xlarge</em>
-screen configuration), you can embed two or more fragments in one activity, but on a normal-sized
-screen (<em>normal</em> screen configuration), you can embed just one fragment in an activity and
-then start other activities in order to display the other fragments.</p>
--->
-
-<p>When you use a fragment as a part of your layout, it technically lives within a {@link
-android.view.View} of the activity's layout and defines its own layout of views. You can insert a
-fragment into your activity layout by declaring the fragment in the activity's XML layout file, as
-a {@code &lt;fragment&gt;} element, or from your application code by adding it to an existing {@link
-android.view.View}. However, a fragment is not required to be a part of the activity
-layout&mdash;you might use a fragment as an invisible worker for the activity (more about that
-later).</p>
-
-<p>The rest of this document describes how to build your application to use fragments, including
-how fragments can contribute to the activity options menu and action bar, create context menus,
-maintain their state when added to the activity's back stack, and more.</p>
-
-
-
-<h2 id="Creating">Creating a Fragment</h2>
-
-<p>An implementation of the {@link android.app.Fragment} class contains code that looks a lot like
-the code in an {@link android.app.Activity}. In fact, if you're
-converting an existing Android application to use fragments, you'll move code
-from your {@link android.app.Activity} implementation into your {@link android.app.Fragment} class
-implementation, and into some of the same callback methods. A fragment contains callback methods
-similar to an activity, such as {@link android.app.Fragment#onCreate onCreate()}, {@link
-android.app.Fragment#onStart onStart()}, {@link android.app.Fragment#onPause onPause()}, and {@link
-android.app.Fragment#onStop onStop()}.</p>
-
-<p>If you're creating a fragment to be a modular piece of an activity UI, then your
-implementation of {@link android.app.Fragment} should include most of the same lifecycle
-callback methods traditionally implemented by the activity to initialize elements of the UI and
-save and restore state information. Usually, you'll want to implement the following methods:</p>
-
-<dl>
- <dt>{@link android.app.Fragment#onCreate onCreate()}</dt>
- <dd>The system calls this when creating the fragment. Within your implementation, you should
-initialize the essential components of the fragment that should be retained when the fragment is
-paused or stopped.</dd>
- <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
- <dd>The system calls this when it's time for the fragment to draw its user interface for the
-first time. To draw a UI for your fragment, you must return a {@link android.view.View} from this
-method that is the root of your fragment's layout. You can return null if the fragment does not
-provide a UI.</dd>
- <dt>{@link android.app.Activity#onPause onPause()}</dt>
- <dd>The system calls this method as the first indication that the user is leaving the
-fragment (though it does not always mean the fragment is being destroyed). This is usually where you
-should commit any changes that should be persisted beyond the current user session (because
-the user might not come back).</dd>
-</dl>
-
-<p>Most applications should implement at least these three methods for each fragment, but there are
-several other lifecycle callback methods that you should also use in order to provide the best
-user experience when switching fragments and when the activity is paused or stopped. All of the
-lifecycle callback methods are discussed more later, in
-the section about <a href="#Lifecycle">Handling the Lifecycle</a>.</p>
-
-
-<p>There are also a few different subclasses of {@link android.app.Fragment} that you might want
-to use:</p>
-
-<dl>
- <dt>{@link android.app.DialogFragment}</dt>
- <dd>Displays a floating dialog. Using this class to create a dialog is a good alternative to using
-the dialog helper methods in the {@link android.app.Activity} class, because the dialog can be
-incorporated into the fragment back stack managed by the activity.</dd>
-
- <dt>{@link android.app.ListFragment}</dt>
- <dd>Displays a list of items that are managed by an adapter (such as a {@link
-android.widget.SimpleCursorAdapter}), similar to {@link android.app.ListActivity}. Provides methods
-for managing a list, such as the {@link
-android.app.ListFragment#onListItemClick(ListView,View,int,long) onListItemClick()} callback to
-handle click events on list items.</dd>
-
- <dt>{@link android.preference.PreferenceFragment}</dt>
- <dd>Displays a hierarchy of {@link android.preference.Preference} objects as a list, similar to
-{@link android.preference.PreferenceActivity}. </dd>
-</dl>
-
-<p>However, subclassing the standard {@link android.app.Fragment} class is most common, if
-you're not creating a dialog, a list, or displaying preferences.</p>
-
-
-<h3 id="UI">Providing a user interface</h3>
-
-<p>To provide a UI layout for a fragment, you must implement
-the {@link android.app.Fragment#onCreateView onCreateView()}
-callback method in your {@link android.app.Fragment} (unless your fragment is a subclass of
-{@link android.app.ListFragment}, which returns a {@link android.widget.ListView} from this method
-by default). The Android system calls {@link android.app.Fragment#onCreateView onCreateView()} when
-it's time for the fragment to draw its layout. Your implementation of this method must return a
-{@link android.view.View} that is the root of your fragment's layout.</p>
-
-<p>The easiest way to provide your layout is to inflate it from a <a
-href="{@docRoot}guide/topics/resources/layout-resource.html">layout resource</a>. To help you
-inflate a layout, the {@link android.app.Fragment#onCreateView onCreateView()} method passes a
-{@link android.view.LayoutInflater} that you can use to get your layout. For example, here's a
-simple subclass of {@link android.app.Fragment} that contains an implementation of {@link
-android.app.Fragment#onCreateView onCreateView()} that loads the fragment's layout from a
-resource:</p>
-
-<pre>
-public static class SimpleFragment extends Fragment {
- &#64;Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.simple_fragment, container, false);
- }
-}
-</pre>
-
-<p>The {@link android.view.LayoutInflater#inflate(int,ViewGroup,boolean) inflate()} method takes
-three arguments:</p>
-<ul>
- <li>The resource ID of the layout you want to inflate</li>
- <li>The {@link android.view.ViewGroup} to be the parent of the
-inflated layout (supplying this is important in order to apply layout parameters from the parent
-view)</li>
- <li>And a boolean indicating whether the inflated layout should be attached to the {@link
-android.view.ViewGroup} (from the second parameter) during inflation (in this case, this
-is false because the system is already going to insert the layout into the appropriate parent
-view&mdash;doing otherwise would create a redundant view group in the final layout)</li>
-</ul>
-
-<p>The {@code container} parameter passed to {@link android.app.Fragment#onCreateView
-onCreateView()} provides the parent {@link android.view.ViewGroup} in which your fragment layout
-will be inserted, which you can use to generate layout parameters for your
-fragment layout. The {@code savedInstanceState} parameter is a {@link android.os.Bundle} that
-provides data about the previous instance of the fragment, if the fragment is being resumed
-(restoring state is discussed more in the section about <a href="#Lifecycle">Handling the
-Lifecycle</a>.</p>
-
-
-<h3 id="Adding">Adding a Fragment to an Activity</h3>
-
-<p>Each fragment is embedded into the layout of its container activity as a part of the overall view
-hierarchy, whether or not it actually provides a UI. If a fragment is not embedded into the activity
-layout, then it is never created (it does not receive any lifecycle callbacks). There are two ways
-you can add a fragment to the activity layout:</p>
-
-<ul>
- <li><b>Declare the fragment inside the activity's layout XML file.</b>
-<p>In this case, you can
-specify layout properties for the fragment as if it were a view itself and the fragment's layout
-fills that space. For example:</p>
-<pre>
-&lt;?xml version="1.0" encoding="utf-8"?&gt;
-&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent"&gt;
- &lt;fragment android:name="com.example.news.ArticleListFragment"
- android:id="@+id/list"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="match_parent" /&gt;
- &lt;fragment android:name="com.example.news.ArticleReaderFragment"
- android:id="@+id/viewer"
- android:layout_weight="2"
- android:layout_width="0dp"
- android:layout_height="match_parent" /&gt;
-&lt;/LinearLayout&gt;
-</pre>
- <p>The {@code &lt;fragment&gt;} element uses the {@code android:name} attribute to specify the
-{@link android.app.Fragment} class to instantiate and insert into the layout. When the activity
-layout is created, the system instantiates each fragment in the layout and calls its {@link
-android.app.Fragment#onCreateView onCreateView()} method in order to retrieve the fragment's
-layout. The {@link android.view.View} object returned by {@link
-android.app.Fragment#onCreateView onCreateView()} is then
-placed directly in the activity layout in place of the {@code &lt;fragment&gt;} element.</p>
-
-<div class="note">
- <p><strong>Note:</strong> Each fragment requires a unique identifier that
-the system can use to restore the fragment if the activity is restarted (and which you can use to
-perform fragment transactions). There are three ways to identify a fragment:</p>
- <ul>
- <li>Supply the {@code android:id} attribute with a unique ID, in the {@code
-&lt;fragment&gt;}</li>
- <li>Supply the {@code android:tag} attribute with a unique string ID, in the {@code
- &lt;fragment&gt;}</li>
- <li>If neither of the previous two are provided, the system uses the ID of the container
- view.</li>
- </ul>
-</div>
- </li>
-
- <li><b>Or, programmatically add the fragment to an existing {@link android.view.ViewGroup}.</b>
-<p>At any time while your activity is running (in the "resumed" state), you can add (and remove)
-fragments to your activity layout. You simply need to specify a {@link android.view.ViewGroup} in
-which to place the fragment.</p>
- <p>To make any fragment transactions in your activity (such as add, remove, or replace a
-fragment), you must use APIs from {@link android.app.FragmentTransaction}. You can get an instance
-of {@link android.app.FragmentTransaction} from your {@link android.app.FragmentManager} using {@link
-android.app.FragmentManager#openTransaction()}. You can then add a fragment using the {@link
-android.app.FragmentTransaction#add add()} method, specifying the fragment to add and the view in
-which to insert it. For example:</p>
-<pre>
-MyFragment fragment = new MyFragment();
-getFragmentManager().openTransaction().add(R.id.fragment_container, fragment).commit();
-</pre>
- <p>The first argument passed to {@link android.app.FragmentTransaction#add add()}
-is the {@link android.view.ViewGroup} in which the fragment should be placed, specified by
-resource ID, and the second parameter is the fragment object.</p>
- <p>Once you've made your changes using
-{@link android.app.FragmentTransaction}, you must
-call {@link android.app.FragmentTransaction#commit} in order for the changes to take effect.</p>
- </li>
-</ul>
-
-
-<h3 id="Example1">Example: simple fragments</h3>
-
-<p>In the last couple sections, you saw how to declare layout for a fragment and add it to an
-activity. What follows is some code that brings it all together, like a "Hello World" for
-fragments.</p>
-
-<p>First, here's a layout file for a fragment:</p>
-<pre>
-&lt;?xml version="1.0" encoding="utf-8"?&gt;
-&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent" &gt;
-&lt;TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello" /&gt;
-&lt;TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello" /&gt;
-&lt;/LinearLayout&gt;
-</pre>
-
-<p>With that file saved at {@code res/layout/simple_fragment.xml}, the following {@link
-android.app.Fragment} uses it for its layout:</p>
-
-<pre>
-public static class SimpleFragment extends Fragment {
- &#64;Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.simple_fragment, null);
- }
-}
-</pre>
-
-<p>And the following layout for an activity applies the fragment twice, side by side:</p>
-
-<pre>
-&lt;?xml version="1.0" encoding="utf-8"?&gt;
-&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="match_parent"&gt;
- &lt;fragment android:name="com.example.SimpleFragment"
- android:id="@+id/list"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="match_parent" /&gt;
- &lt;fragment android:name="com.example.SimpleFragment"
- android:id="@+id/viewer"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="match_parent" /&gt;
-&lt;/LinearLayout&gt;
-</pre>
-
-<p>That's it. When an activity applies the previous layout as its content, the {@code
-SimpleFragment} class is instantiated for each occurence in the layout, applying the fragment
-layout when it receives the call to {@link android.app.Fragment#onCreateView onCreateView()}.</p>
-
-<p>Although the fragment in this example implements only the {@link
-android.app.Fragment#onCreateView onCreateView()} callback, there are several other lifecycle
-callback methods that you should implement in your application. For example, {@link
-android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onPause onPause()}, {@link
-android.app.Fragment#onStop onStop()} and others that coincide with the fragment's lifecycle.</p>
-
-
-
-<h2 id="Managing">Managing Fragments</h2>
-
-<p>A useful feature of fragments is the ability to add, remove, replace, and perform other
-operations on a fragment as the user interacts with the activity, alowing for more rich user
-experiences without changing activities. In order to perform these operations, you must use {@link
-android.app.FragmentTransaction} to perform fragment "transactions." You can acquire {@link
-android.app.FragmentTransaction} from your FragmentManager with {@link
-android.app.FragmentManager#openTransaction}.</p>
-
-<p>Common transactions you can perform with fragments include:</p>
-
-<dl>
- <dt>{@link android.app.FragmentTransaction#add add()}</dt>
- <dd>Add a {@link android.app.Fragment} to the {@link android.app.Activity} layout.</dd>
- <dt>{@link android.app.FragmentTransaction#remove remove()}</dt>
- <dd>Remove a {@link android.app.Fragment} from the {@link android.app.Activity} layout.</dd>
- <dt>{@link android.app.FragmentTransaction#replace replace()}</dt>
- <dd>Replace an existing {@link android.app.Fragment} with another one.</dd>
-</dl>
-
-<p>For every transaction (or set of transactions) you perform, you must call {@link
-android.app.FragmentTransaction#commit} in order for the transactions made with {@link
-android.app.FragmentTransaction} to be applied. Before you do, however, you can call {@link
-android.app.FragmentTransaction#addToBackStack} to add the current fragment state to the
-activity's back stack, so that the user can return to the previous fragment state with the BACK key.
-For example, here's how a new fragment can replace another one, but keep the previous fragment
-in the back stack:</p>
-
-<pre>
-// Create new fragment
-Fragment newFragment = new MyFragment();
-FragmentTransaction ft = getFragmentManager().openTransaction();
-// Replace and add to back stack
-ft.replace(R.id.myfragment, newFragment);
-ft.addToBackStack(null);
-// Apply changes
-ft.commit();
-</pre>
-
-<p>In this example, {@code newFragment} replaces whatever fragment is currently in the
-layout container identified by the {@code R.id.myfragment} ID. By calling {@link
-android.app.FragmentTransaction#addToBackStack addToBackStack()}, this transaction (the replace) is
-saved to the activity's back stack so that the user can reverse this change and bring back the
-previous fragment by pressing the BACK key.</p>
-
-<p>If you perform multiple transactions and call {@link
-android.app.FragmentTransaction#addToBackStack addToBackStack()}, then all transactions performed
-before {@link android.app.FragmentTransaction#commit} are added to the activity's back stack as a
-single event and the BACK key will reverse them all together.</p>
-
-
-
-<h2 id="Lifecycle">Handling the Lifecycle</h2>
-
-<p>A fragment has a lifecycle that corresponds to the lifecycle of the activity in which it
-resides. For example, a fragment has callback methods {@link
-android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onStart onStart()}, {@link
-android.app.Fragment#onPause onPause()}, {@link android.app.Fragment#onStop onStop()}, and more.</p>
-
-<p>The lifecycle of the activity directly affects the lifecycle of the fragment, such that each
-lifecycle callback for the activity results in a similar callback for each fragment (for
-example, when the activity receives {@link android.app.Activity#onPause}, each fragment receives
-{@link android.app.Fragment#onPause}). However, the
-fragment's lifecycle can also change independently&mdash;but only while the activity is
-resumed (while it is in the foreground)&mdash;because you can dynamically
-add, remove, and replace fragments without any change to the lifecycle of the activity.</p>
-
-<p>To accomodate backward navigation with the
-BACK key, you can optionally maintain a back stack of fragment transactions, as described in the
-previous section. So, if you
-replace one fragment with another, the user can press the BACK key and view the previous
-fragment. Additionally, each fragment can maintain its own state, such that
-when the user navigates back to a previous fragment, the state of that fragment can be restored in
-the same manner as the state of an activity is restored when it is stopped and restarted.</p>
-
-<p>Managing the lifecycle of a fragment is a lot like managing the lifecycle of an activity. A
-fragment and an activity both have an "resumed," "paused," and "stopped" state, and they can both
-retain their state using a {@link android.os.Bundle}. The only significant difference is that an
-activity is placed into a the task's back stack by default (so that the user can navigate to
-the previous activity with the BACK key), but a fragment is placed into the activity's back stack
-only when you explicitly call {@link android.app.FragmentTransaction#addToBackStack(String)
-addToBackStack()} before you {@link android.app.FragmentTransaction#commit()} a fragment
-transaction.</p>
-
-<p>The order in which you perform transactions with {@link android.app.FragmentTransaction} doesn't
-matter, except:</p>
-<ul>
- <li>You must call {@link android.app.FragmentTransaction#commit()} last</li>
- <li>If you're adding multiple fragments to the same container, then the order in which
-you add them determines the order they appear</li>
-</ul>
-<p>If you do not call {@link android.app.FragmentTransaction#addToBackStack(String)
-addToBackStack()} when you perform a transaction that removes a fragment, then that fragment is
-destroyed when the transaction is committed.</p>
-
-
-<h3 id="CoordinatingWithTheActivity">Coordinating with the activity lifecycle</h3>
-
-<p>The lifecycle of an activity directly affects the lifecycle of a {@link android.app.Fragment}
-embedded in that activity. The {@link android.app.Fragment} class has lifecycle callback
-methods that match those in the {@link android.app.Activity} class.</p>
-
-<p>Fragments have a few extra lifecycle callbacks, however, that handle unique interaction with the
-activity in order to perform actions such as build and destroy the fragment's UI. These additional
-callback methods are:</p>
-
-<dl>
- <dt>{@link android.app.Fragment#onAttach onAttach()}</dt>
- <dd>Called when the fragment has been associated with the activity (the {@link
-android.app.Activity} is passed in here).</dd>
- <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
- <dd>Called to create the view hierarchy associated with the fragment.</dd>
- <dt>{@link android.app.Fragment#onActivityCreated onActivityCreated()}</dt>
- <dd>Called when the activity's own {@link android.app.Activity#onCreate
-onCreate()} has finished.</dd>
- <dt>{@link android.app.Fragment#onDestroyView onDestroyView()}</dt>
- <dd>Called when the view hierarchy associated with the fragment is being removed.</dd>
- <dt>{@link android.app.Fragment#onDetach onDetach()}</dt>
- <dd>Called when the fragment is being disassociated from the activity.</dd>
-</dl>
-
-<p>The flow of a fragment's lifecycle, as it is affected by its container activity, is illustrated
-by figure 3. In this figure, you can see how each successive state of the activity determines which
-callback methods the fragment may receive. For example, when the activity has received
-its {@link android.app.Activity#onCreate onCreate()} callback, the fragment receives no more
-than the {@link android.app.Fragment#onActivityCreated onActivityCreated()} callback. However,
-once the activity reaches the resumed state, you can freely add and remove fragments to the
-activity, so the fragment lifecycle is no longer inhibitted by the state of the activity. Yet,
-when the activity leaves the resumed state, the fragment again is pushed through its lifecycle by
-the activity (unless you explicitly destroy the fragment sooner).</p>
-
-
-<img src="{@docRoot}images/activity_fragment_lifecycle.png" alt=""/>
-<p class="img-caption"><strong>Figure 3.</strong> The activity lifecycle's affect on the lifecycle
-of a fragment.</p>
-
-
-<h3 id="Integrating">Integrating with the Activity</h3>
-
-<p>Although a {@link android.app.Fragment} is implemented separate from an {@link
-android.app.Activity} and can be used inside multiple activities, a fragment is directly tied to its
-container activity and can access the Activity instance with {@link
-android.app.Fragment#getActivity()}. So, a fragment can
-easily perform tasks such as find a view in the activity:</p>
-
-<pre>
-View listView = {@link android.app.Fragment#getActivity()}.{@link android.app.Activity#findViewById findViewById}(R.id.list);
-</pre>
-
-<p>This makes it easy for your fragment to call public methods in the activity.</p>
-
-<p>Likewise, your activity can call public methods in the fragment when you have a reference to the
-{@link android.app.Fragment}. You can acquire a reference to the fragment with {@link
-android.app.FragmentManager#findFragmentById findFragmentById()} and cast it to your implementation of
-{@link android.app.Fragment}. For example:</p>
-
-<pre>
-MyFragment fragment = (MyFragment) findFragmentById(R.id.myfragment);
-fragment.refreshList();
-</pre>
-
-
-<h4 id="Callbacks">Creating event callbacks to the activity</h4>
-
-<p>In some cases, you might need a fragment to share events with the activity. A good way to do that
-is to define a callback interface inside the fragment and require that the host activity implement
-it. When the activity receives a callback, it can share the information with other fragments in the layout as
-necessary.</p>
-
-<p>For example, if a news application has two fragments in an activity&mdash;one to show a list of
-articles (fragment A) and another to display an article (fragment B)&mdash;then fragment A must tell
-the activity when a list item is selected so that it can tell fragment B to display the article. In
-this case, the following interface is defined inside fragment A:</p>
-
-<pre>
-public static class FragmentA extends ListFragment {
- ...
- // Container Activity must implement this interface
- public interface SelectedCallback {
- public void onArticleSelected(Uri articleUri);
- }
- ...
-}
-</pre>
-
-<p>Then the activity that hosts the fragment implements the {@code SelectedCallback} interface and
-overrides {@code onArticleSelected()} to notify fragment B of the event from fragment A. To ensure
-that the host activity implements this interface, fragment A's {@link
-android.app.Fragment#onAttach onAttach()} callback method (called when
-the fragment is added to the activity) instantiates an instance of {@code SelectedCallback} by
-casting the {@link android.app.Activity} that is passed into {@link android.app.Fragment#onAttach
-onAttach()}:</p>
-
-<pre>
-public static class FragmentA extends ListFragment {
- ...
- &#64;Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mCallback = (SelectedCallback) activity;
- } catch (ClassCastException e) {
- activity.finish();
- throw new ClassCastException(activity.toString() + " must implement SelectedCallback");
- }
- }
- ...
-}
-</pre>
-
-<p>If the activity has not implemented the interface, then a {@link java.lang.ClassCastException} is
-thrown and the activity is shut down. On success, the {@code mCallback} member holds a reference to
-the {@link android.app.Activity}, so that fragment A can share events with the activity by calling
-methods defined by the {@code SelectedCallback} interface. For example, if fragment A is an
-extension of {@link android.app.ListFragment}, each time
-the user clicks a list item, the system calls {@link android.app.ListFragment#onListItemClick
-onListItemClick()} in the fragment, which then calls {@code onArticleSelected()} to share
-the event with the activity:</p>
-
-<pre>
-public static class FragmentA extends ListFragment {
- ...
- &#64;Override
- public void onListItemClick(ListView l, View v, int position, long id) {
- // Append the clicked item's row ID with the content provider Uri
- Uri noteUri = ContentUris.{@link android.content.ContentUris#withAppendedId withAppendedId}(ArticleColumns.CONTENT_URI, id);
- // Send the event and Uri to the host activity
- mCallback.onArticleSelected(noteUri);
- }
- ...
-}
-</pre>
-
-<p>The {@code id} parameter passed to {@link
-android.app.ListFragment#onListItemClick onListItemClick()} is the row ID of the clicked item,
-which the activity (or other fragment) uses to fetch the article from the application's {@link
-android.content.ContentProvider}.</p>
-
-<p><!--To see a complete implementation of this kind of callback interface, see the <a
-href="{@docRoot}resources/samples/NotePad/index.html">NotePad sample</a>. -->More information about
-using a content provider is available in the <a
-href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a> document.</p>
-
-
-
-
-
-
-<h2 id="Menus">Adding Action Items to the Activity</h2>
-
-<p>Your fragments can contribute action items to the activity's <a
-href="{@docRoot}guide/topics/ui/actionbar.html">action bar</a> (and menu items to the options menu)
-using the callback methods
-{@link android.app.Fragment#onCreateOptionsMenu(Menu,MenuInflater) onCreateOptionsMenu()}. In order
-for this method to receive calls, however, you must call {@link
-android.app.Fragment#setHasOptionsMenu(boolean) setHasOptionsMenu()} during the {@link
-android.app.Fragment#onCreate(Bundle) onCreate()} callback in order to indicate that the fragment
-would like to receive a call to {@link android.app.Fragment#onCreateOptionsMenu(Menu,MenuInflater)
-onCreateOptionsMenu()}. Any action or menu items that you add from the fragment are appended to the
-existing
-items for the options menu (including those added by other fragments in the activity). The
-fragment also receives item-selected events with the {@link
-android.app.Fragment#onOptionsItemSelected(MenuItem) onOptionsItemSelected()} callback method.</p>
-
-<p>The {@link android.app.Fragment} class also contains methods to handle context menus. You can
-register a view to provide a context menu with {@link
-android.app.Fragment#registerForContextMenu(View) registerForContextMenu()}. When the user opens
-the context menu, the fragment receives a call to {@link
-android.app.Fragment#onCreateContextMenu(ContextMenu,View,ContextMenu.ContextMenuInfo)
-onCreateContextMenu()}. When the user selects an item, the fragment receives a call to {@link
-android.app.Fragment#onContextItemSelected(MenuItem) onContextItemSelected()}.</p>
-
-<p>For more information, see <a href="{@docRoot}guide/topics/ui/menus.html">Creating
-Menus</a> and <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the Action Bar</a>.</p>
-
-
-
-
-
-
diff --git a/docs/html/guide/topics/fundamentals/fragments.jd b/docs/html/guide/topics/fundamentals/fragments.jd
new file mode 100644
index 000000000000..09728059c27a
--- /dev/null
+++ b/docs/html/guide/topics/fundamentals/fragments.jd
@@ -0,0 +1,815 @@
+page.title=Fragments
+@jd:body
+
+<div id="qv-wrapper">
+<div id="qv">
+
+ <h2>Quickview</h2>
+ <ul>
+ <li>Fragments decompose application functionality and UI into reusable modules</li>
+ <li>Add multiple fragments to a screen to avoid switching activities</li>
+ <li>Fragments have their own lifecycle, state, and back stack</li>
+ <li>Fragments require API Level HONEYCOMB or greater</li>
+ </ul>
+
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#Design">Design Philosophy</a></li>
+ <li><a href="#Creating">Creating a Fragment</a>
+ <ol>
+ <li><a href="#UI">Adding a user interface</a></li>
+ <li><a href="#Adding">Adding a fragment to an activity</a></li>
+ </ol>
+ </li>
+ <li><a href="#Managing">Managing Fragments</a></li>
+ <li><a href="#Transactions">Performing Fragment Transactions</a></li>
+ <li><a href="#CommunicatingWithActivity">Communicating with the Activity</a>
+ <ol>
+ <li><a href="#EventCallbacks">Creating event callbacks to the activity</a></li>
+ <li><a href="#ActionBar">Adding items to the Action Bar</a></li>
+ </ol>
+ </li>
+ <li><a href="#Lifecycle">Handling the Fragment Lifecycle</a>
+ <ol>
+ <li><a href="#CoordinadingWithActivity">Coordinating with the activity lifecycle</a></li>
+ </ol>
+ </li>
+ <li><a href="#Example">Example</a></li>
+ </ol>
+
+ <h2>Key classes</h2>
+ <ol>
+ <li>{@link android.app.Fragment}</li>
+ <li>{@link android.app.FragmentManager}</li>
+ <li>{@link android.app.FragmentTransaction}</li>
+ </ol>
+
+ <h2>Related samples</h2>
+ <ol>
+ <li><a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">ApiDemos</a></li>
+ </ol>
+</div>
+</div>
+
+<p>A {@link android.app.Fragment} represents a behavior or a portion of user interface in an
+{@link android.app.Activity}. You can combine multiple fragments in a single activity to build a
+multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a
+modular section of an activity, which has its own lifecycle, receives its own input events, and
+which you can add or remove while the activity is running.</p>
+
+<p>A fragment must always be embedded in an activity and the fragment's lifecycle is directly
+affected by the activity's lifecycle. For example, when the activity is paused, so are all
+fragments in it, and when the activity is destroyed, so are all fragments. However, while an
+activity is running (it is in the <em>resumed</em> <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">lifecycle state</a>), you can
+manipulate each fragment independently, such as add or remove them. When you perform such a
+fragment transaction, you can it to a back stack managed by the
+activity&mdash;each back stack entry in the activity is a record of the fragment transaction that
+occurred. The back stack allows the user to reverse a fragment transaction (navigate backwards),
+by pressing the BACK key.</p>
+
+<p>When you add a fragment as a part of your activity layout, it lives in a {@link
+android.view.ViewGroup} inside the activity's view hierarchy and defines its own layout of views.
+You can insert a fragment into your activity layout by declaring the fragment in the activity's
+layout file, as a {@code &lt;fragment&gt;} element, or from your application code by adding it to an
+existing {@link android.view.ViewGroup}. However, a fragment is not required to be a part of the
+activity layout; you may also use a fragment as an invisible worker for the activity.</p>
+
+<p>This document describes how to build your application to use fragments, including
+how fragments can maintain their state when added to the activity's back stack, share
+events with the activity and other fragments in the activity, contribute to the activity's action
+bar, and more.</p>
+
+
+<h2 id="Design">Design Philosophy</h2>
+
+<p>Android introduced fragments in Android 3.0 (API Level "Honeycomb"), primarily to support more
+dynamic and flexible UI designs on large screens, such as tablets. Because a
+tablet's screen is much larger than that of a mobile phone, there's more room to combine and
+interchange UI components. Fragments allow such designs without the need for you to manage complex
+changes to the view hierarchy. By dividing the layout of an activity into fragments, you become able
+to modify the activity's appearance at runtime and preserve those changes in a back stack
+that's managed by the activity.</p>
+
+<p>For example, a news application can use one fragment to show a list of articles on the
+left and another fragment to display an article on the right&mdash;both fragments appear in one
+activity, side by side, and each fragment has its own set of lifecycle callback methods and handle
+their own user input events. Thus, instead of using one activity to select an article and another
+activity to read the article, the user can select an article and read it all within the same
+activity, as illustrated in figure 1.</p>
+
+<img src="{@docRoot}images/fundamentals/fragments.png" alt="" />
+<p class="img-caption"><strong>Figure 1.</strong> An example of how two UI modules that are
+typically separated into two activities can be combined into one activity, using fragments.</p>
+
+
+<p>A fragment should be a modular and reusable component in your application. That is, because the
+fragment defines its own layout and its own behavior using its own lifecycle callbacks, you
+can include one fragment in multiple activities. This is especially important because it allows you
+to adapt your user experience to different screen sizes. For instance, you might include multiple
+fragments in an activity only when the screen size is sufficiently large, and, when it is not,
+launch separate activities that use different fragments.</p>
+
+<p>For example&mdash;to continue with the news application example&mdash;the application can embed
+two
+fragments in <em>Activity A</em>, when running on an extra large screen (a tablet, for example).
+However, on a normal-sized screen (a phone, for example),
+there's not be enough room for both fragments, so <em>Activity A</em> includes only the fragment for
+the list of articles, and when the user selects an article, it starts <em>Activity B</em>, which
+includes the fragment to read the article. Thus, the application supports both design patterns
+suggested in figure 1.</p>
+
+
+
+<h2 id="Creating">Creating a Fragment</h2>
+
+<div class="figure" style="width:314px">
+<img src="{@docRoot}images/fragment_lifecycle.png" alt="" />
+<p class="img-caption"><strong>Figure 2.</strong> The lifecycle of a fragment (while its
+activity is running).</p>
+</div>
+
+<p>To create a fragment, you must create a subclass of {@link android.app.Fragment} (or an existing
+subclass of it). The {@link android.app.Fragment} class has code that looks a lot like
+an {@link android.app.Activity}. It contains callback methods similar to an activity, such
+as {@link android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onStart onStart()},
+{@link android.app.Fragment#onPause onPause()}, and {@link android.app.Fragment#onStop onStop()}. In
+fact, if you're converting an existing Android application to use fragments, you might simply move
+code from your activity's callback methods into the respective callback methods of your
+fragment.</p>
+
+<p>Usually, you should implement at least the following lifecycle methods:</p>
+
+<dl>
+ <dt>{@link android.app.Fragment#onCreate onCreate()}</dt>
+ <dd>The system calls this when creating the fragment. Within your implementation, you should
+initialize essential components of the fragment that you want to retain when the fragment is
+paused or stopped, then resumed.</dd>
+ <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
+ <dd>The system calls this when it's time for the fragment to draw its user interface for the
+first time. To draw a UI for your fragment, you must return a {@link android.view.View} from this
+method that is the root of your fragment's layout. You can return null if the fragment does not
+provide a UI.</dd>
+ <dt>{@link android.app.Activity#onPause onPause()}</dt>
+ <dd>The system calls this method as the first indication that the user is leaving the
+fragment (though it does not always mean the fragment is being destroyed). This is usually where you
+should commit any changes that should be persisted beyond the current user session (because
+the user might not come back).</dd>
+</dl>
+
+<p>Most applications should implement at least these three methods for every fragment, but there are
+several other callback methods you should also use to handle various stages of the
+fragment lifecycle. All the lifecycle callback methods are discussed more later, in the section
+about <a href="#Lifecycle">Handling the Fragment Lifecycle</a>.</p>
+
+
+<p>There are also a few subclasses that you might want to extend, instead of the base {@link
+android.app.Fragment} class:</p>
+
+<dl>
+ <dt>{@link android.app.DialogFragment}</dt>
+ <dd>Displays a floating dialog. Using this class to create a dialog is a good alternative to using
+the dialog helper methods in the {@link android.app.Activity} class, because you can
+incorporate a fragment dialog into the back stack of fragments managed by the activity,
+allowing the user to return to a dismissed fragment.</dd>
+
+ <dt>{@link android.app.ListFragment}</dt>
+ <dd>Displays a list of items that are managed by an adapter (such as a {@link
+android.widget.SimpleCursorAdapter}), similar to {@link android.app.ListActivity}. It provides
+several methods for managing a list view, such as the {@link
+android.app.ListFragment#onListItemClick(ListView,View,int,long) onListItemClick()} callback to
+handle click events.</dd>
+
+ <dt>{@link android.preference.PreferenceFragment}</dt>
+ <dd>Displays a hierarchy of {@link android.preference.Preference} objects as a list, similar to
+{@link android.preference.PreferenceActivity}. This is useful when creating a "settings"
+activity for your application.</dd>
+</dl>
+
+
+<h3 id="UI">Adding a user interface</h3>
+
+<p>A fragment is usually used as part of an activity's user interface and contributes its own
+layout to the activity.</p>
+
+<p>To provide a layout for a fragment, you must implement the {@link
+android.app.Fragment#onCreateView onCreateView()} callback method, which the Android system calls
+when it's time for the fragment to draw its layout. Your implementation of this method must return a
+{@link android.view.View} that is the root of your fragment's layout.</p>
+
+<p class="note"><strong>Note:</strong> If your fragment is a subclass of {@link
+android.app.ListFragment}, the default implementation returns a {@link android.widget.ListView} from
+{@link android.app.Fragment#onCreateView onCreateView()}, so you don't need to implement it.</p>
+
+<p>To return a layout from {@link
+android.app.Fragment#onCreateView onCreateView()}, you can inflate it from a <a
+href="{@docRoot}guide/topics/resources/layout-resource.html">layout resource</a> defined in XML. To
+help you do so, {@link android.app.Fragment#onCreateView onCreateView()} provides a
+{@link android.view.LayoutInflater} object.</p>
+
+<p>For example, here's a subclass of {@link android.app.Fragment} that loads a layout from the
+{@code example_fragment.xml} file:</p>
+
+<pre>
+public static class ExampleFragment extends Fragment {
+ &#64;Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.example_fragment, container, false);
+ }
+}
+</pre>
+
+<div class="sidebox-wrapper">
+<div class="sidebox">
+ <h3>Creating a layout</h3>
+ <p>In the sample above, {@code R.layout.example_fragment} is a reference to a layout resource
+named {@code example_fragment.xml} saved in the application resources. For information about how to
+create a layout in XML, see the <a href="{@docRoot}guide/topics/ui/index.html">User Interface</a>
+documentation.</p>
+</div>
+</div>
+
+<p>The {@code container} parameter passed to {@link android.app.Fragment#onCreateView
+onCreateView()} is the parent {@link android.view.ViewGroup} (from the activity's layout) in which
+your fragment layout
+will be inserted. The {@code savedInstanceState} parameter is a {@link android.os.Bundle} that
+provides data about the previous instance of the fragment, if the fragment is being resumed
+(restoring state is discussed more in the section about <a href="#Lifecycle">Handling the
+Fragment Lifecycle</a>).</p>
+
+<p>The {@link android.view.LayoutInflater#inflate(int,ViewGroup,boolean) inflate()} method takes
+three arguments:</p>
+<ul>
+ <li>The resource ID of the layout you want to inflate.</li>
+ <li>The {@link android.view.ViewGroup} to be the parent of the inflated layout. Passing the {@code
+container} is important in order for the system to apply layout parameters to the root view of the
+inflated layout, specified by the parent view in which it's going.</li>
+ <li>A boolean indicating whether the inflated layout should be attached to the {@link
+android.view.ViewGroup} (the second parameter) during inflation. (In this case, this
+is false because the system is already inserting the inflated layout into the {@code
+container}&mdash;passing true would create a redundant view group in the final layout.)</li>
+</ul>
+
+<p>Now you've seen how to create a fragment that provides a layout. Next, you need to add
+the fragment to your activity.</p>
+
+
+
+<h3 id="Adding">Adding a fragment to an activity</h3>
+
+<p>Usually, a fragment contributes a portion of UI to the host activity, which is embedded as a part
+of the activity's overall view hierarchy. There are two ways you can add a fragment to the activity
+layout:</p>
+
+<ul>
+ <li><b>Declare the fragment inside the activity's layout file.</b>
+<p>In this case, you can
+specify layout properties for the fragment as if it were a view. For example, here's the layout
+file for an activity with two fragments:</p>
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"&gt;
+ &lt;fragment android:name="com.example.news.ArticleListFragment"
+ android:id="@+id/list"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="match_parent" /&gt;
+ &lt;fragment android:name="com.example.news.ArticleReaderFragment"
+ android:id="@+id/viewer"
+ android:layout_weight="2"
+ android:layout_width="0dp"
+ android:layout_height="match_parent" /&gt;
+&lt;/LinearLayout&gt;
+</pre>
+ <p>The {@code android:name} attribute in the {@code &lt;fragment&gt;} specifies the {@link
+android.app.Fragment} class to instantiate in the layout.</p>
+
+<p>When the system creates this activity layout, it instantiates each fragment specified in the
+layout and calls the {@link android.app.Fragment#onCreateView onCreateView()} method for each one,
+to retrieve each fragment's layout. The system inserts the {@link android.view.View} returned by the
+fragment directly in place of the {@code &lt;fragment&gt;} element.</p>
+
+<div class="note">
+ <p><strong>Note:</strong> Each fragment requires a unique identifier that
+the system can use to restore the fragment if the activity is restarted (and which you can use to
+capture the fragment to perform transactions, such as remove it). There are three ways to provide an
+ID for a fragment:</p>
+ <ul>
+ <li>Supply the {@code android:id} attribute with a unique ID.</li>
+ <li>Supply the {@code android:tag} attribute with a unique string.</li>
+ <li>If you provide neither of the previous two, the system uses the ID of the container
+view.</li>
+ </ul>
+</div>
+ </li>
+
+ <li><b>Or, programmatically add the fragment to an existing {@link android.view.ViewGroup}.</b>
+<p>At any time while your activity is running, you can add fragments to your activity layout. You
+simply need to specify a {@link
+android.view.ViewGroup} in which to place the fragment.</p>
+ <p>To make fragment transactions in your activity (such as add, remove, or replace a
+fragment), you must use APIs from {@link android.app.FragmentTransaction}. You can get an instance
+of {@link android.app.FragmentTransaction} from your {@link android.app.Activity} like this:</p>
+
+<pre>
+FragmentManager fragmentManager = {@link android.app.Activity#getFragmentManager()}
+FragmentTransaction fragmentTransaction = fragmentManager.{@link android.app.FragmentManager#beginTransaction()};
+</pre>
+
+<p>You can then add a fragment using the {@link
+android.app.FragmentTransaction#add(int,Fragment) add()} method, specifying the fragment to add and
+the view in which to insert it. For example:</p>
+
+<pre>
+ExampleFragment fragment = new ExampleFragment();
+fragmentTransaction.add(R.id.fragment_container, fragment);
+fragmentTransaction.commit();
+</pre>
+
+ <p>The first argument passed to {@link android.app.FragmentTransaction#add(int,Fragment) add()}
+is the {@link android.view.ViewGroup} in which the fragment should be placed, specified by
+resource ID, and the second parameter is the fragment to add.</p>
+ <p>Once you've made your changes with
+{@link android.app.FragmentTransaction}, you must
+call {@link android.app.FragmentTransaction#commit} for the changes to take effect.</p>
+ </li>
+</ul>
+
+
+<h4 id="AddingWithoutUI">Adding a fragment without a UI</h4>
+
+<p>The examples above show how to add a fragment to your activity in order to provide a UI. However,
+you can also use a fragment to provide a background behavior for the activity without presenting
+additional UI.</p>
+
+<p>To add a fragment without a UI, add the fragment from the activity using {@link
+android.app.FragmentTransaction#add(Fragment,String)} (supplying a unique string "tag" for the
+fragment, rather than a view ID). This adds the fragment, but, because it's not associated with a
+view in the activity layout, it does not receive a call to {@link
+android.app.Fragment#onCreateView onCreateView()}. So you don't need to implement that method.</p>
+
+<p>Supplying a string tag for the fragment isn't strictly for non-UI fragments&mdash;you can also
+supply string tags to fragments that do have a UI&mdash;but if the fragment does not have a
+UI, then the string tag is the only way to identify it. If you want to get the fragment from the
+activity later, you need to use {@link android.app.FragmentManager#findFragmentByTag
+findFragmentByTag()}.</p>
+
+<p>For an example activity that uses a fragment as a background worker, without a UI, see the <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.html">{@code
+FragmentRetainInstance.java}</a> sample.</p>
+
+
+
+<h2 id="Managing">Managing Fragments</h2>
+
+<p>To manage the fragments in your activity, you need to use {@link android.app.FragmentManager}. To
+get it, call {@link android.app.Activity#getFragmentManager()} from your activity.</p>
+
+<p>Some things that you can do with {@link android.app.FragmentManager} include:</p>
+
+<ul>
+ <li>Get fragments that exist in the activity, with {@link
+android.app.FragmentManager#findFragmentById findFragmentById()} (for fragments that provide a UI in
+the activity layout) or {@link android.app.FragmentManager#findFragmentByTag
+findFragmentByTag()} (for fragments that do or don't provide a UI).</li>
+ <li>Pop fragments off the back stack, with {@link
+android.app.FragmentManager#popBackStack()} (simulating a BACK command by the user).</li>
+ <li>Register a listener for changes to the back stack, with {@link
+android.app.FragmentManager#addOnBackStackChangedListener addOnBackStackChangedListener()}.</li>
+</ul>
+
+<p>For more information about these methods and others, refer to the {@link
+android.app.FragmentManager} class documentation.</p>
+
+<p>As demonstrated in the previous section, you can also use {@link android.app.FragmentManager}
+to open a {@link android.app.FragmentTransaction}, which allows you to perform transactions, such as
+add and remove fragments.</p>
+
+
+<h2 id="Transactions">Performing Fragment Transactions</h2>
+
+<p>A great feature about using fragments in your activity is the ability to add, remove, replace,
+and perform other actions with them, in response to user interaction. Each set of changes that you
+commit to the activity is called a transaction and you can perform one using APIs in {@link
+android.app.FragmentTransaction}. You can also save each transaction to a back stack managed by the
+activity, allowing the user to navigate backward through the fragment changes (similar to navigating
+backward through activities).</p>
+
+<p>You can acquire an instance of {@link android.app.FragmentTransaction} from the {@link
+android.app.FragmentManager} like this:</p>
+
+<pre>
+FragmentManager fragmentManager = {@link android.app.Activity#getFragmentManager()};
+FragmentTransaction fragmentTransaction = fragmentManager.{@link android.app.FragmentManager#beginTransaction()};
+</pre>
+
+<p>Each transaction is a set of changes that you want to perform at the same time. You can set
+up all the changes you want to perform for a given transaction using methods such as {@link
+android.app.FragmentTransaction#add add()}, {@link android.app.FragmentTransaction#remove remove()},
+and {@link android.app.FragmentTransaction#replace replace()}. Then, to apply the transaction
+to the activity, you must call {@link android.app.FragmentTransaction#commit()}.</p>
+</dl>
+
+<p>Before you call {@link
+android.app.FragmentTransaction#commit()}, however, you might want to call {@link
+android.app.FragmentTransaction#addToBackStack addToBackStack()}, in order to add the transaction
+to a back stack of fragment transactions. This back stack is managed by the activity and allows
+the user to return to the previous fragment state, by pressing the BACK key.</p>
+
+<p>For example, here's how you can replace one fragment with another, and preserve the previous
+state in the back stack:</p>
+
+<pre>
+// Create new fragment and transaction
+Fragment newFragment = new ExampleFragment();
+FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+// Replace whatever is in the fragment_container view with this fragment,
+// and add the transaction to the back stack
+transaction.replace(R.id.fragment_container, newFragment);
+transaction.addToBackStack(null);
+
+// Commit the transaction
+transaction.commit();
+</pre>
+
+<p>In this example, {@code newFragment} replaces whatever fragment (if any) is currently in the
+layout container identified by the {@code R.id.fragment_container} ID. By calling {@link
+android.app.FragmentTransaction#addToBackStack addToBackStack()}, the replace transaction is
+saved to the back stack so the user can reverse the transaction and bring back the
+previous fragment by pressing the BACK key.</p>
+
+<p>If you add multiple changes to the transaction (such as another {@link
+android.app.FragmentTransaction#add add()} or {@link android.app.FragmentTransaction#remove
+remove()}) and call {@link
+android.app.FragmentTransaction#addToBackStack addToBackStack()}, then all changes applied
+before you call {@link android.app.FragmentTransaction#commit commit()} are added to the
+back stack as a single transaction and the BACK key will reverse them all together.</p>
+
+<p>The order in which you add changes to a {@link android.app.FragmentTransaction} doesn't matter,
+except:</p>
+<ul>
+ <li>You must call {@link android.app.FragmentTransaction#commit()} last</li>
+ <li>If you're adding multiple fragments to the same container, then the order in which
+you add them determines the order they appear in the view hierarchy</li>
+</ul>
+
+<p>If you do not call {@link android.app.FragmentTransaction#addToBackStack(String)
+addToBackStack()} when you perform a transaction that removes a fragment, then that fragment is
+destroyed when the transaction is committed and the user cannot navigate back to it. Whereas, if you
+do call {@link android.app.FragmentTransaction#addToBackStack(String) addToBackStack()} when
+removing a fragment, then the fragment is <em>stopped</em> and will be resumed if the user navigates
+back.</p>
+
+<p class="note"><strong>Tip:</strong> For each fragment transaction, you can apply a transition
+animation, by calling {@link android.app.FragmentTransaction#setTransition setTransition()} before
+you commit.</p>
+
+<p>Calling {@link android.app.FragmentTransaction#commit()} does not perform the transaction
+immediately. Rather, it schedules it to run on the activity's UI thread (the "main" thread) as soon
+as the thread is able to do so. If necessary, however, you may call {@link
+android.app.FragmentManager#executePendingTransactions()} from your UI thread to immediately execute
+transactions submitted by {@link android.app.FragmentTransaction#commit()}. Doing so is
+usually not necessary unless the transaction is a dependency for jobs in other threads.</p>
+
+<p class="caution"><strong>Caution:</strong> You can commit a transaction using {@link
+android.app.FragmentTransaction#commit commit()} only prior to the activity <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#SavingActivityState">saving its
+state</a> (when the user leaves the activity). If you attempt to commit after that point, an
+exception will be thrown. This is because the state after the commit can be lost if the activity
+needs to be restored. For situations in which its okay that you lose the commit, use {@link
+android.app.FragmentTransaction#commitAllowingStateLoss()}.</p>
+
+
+
+
+<h2 id="CommunicatingWithActivity">Communicating with the Activity</h2>
+
+<p>Although a {@link android.app.Fragment} is implemented as an object that's independent from an
+{@link android.app.Activity} and can be used inside multiple activities, a given instance of
+a fragment is directly tied to the activity that contains it.</p>
+
+<p>Specifically, the fragment can access the {@link android.app.Activity} instance with {@link
+android.app.Fragment#getActivity()} and easily perform tasks such as find a view in the
+activity layout:</p>
+
+<pre>
+View listView = {@link android.app.Fragment#getActivity()}.{@link android.app.Activity#findViewById findViewById}(R.id.list);
+</pre>
+
+<p>Likewise, your activity can call methods in the fragment by acquiring a reference to the
+{@link android.app.Fragment} from {@link android.app.FragmentManager}, using {@link
+android.app.FragmentManager#findFragmentById findFragmentById()} or {@link
+android.app.FragmentManager#findFragmentByTag findFragmentByTag()}. For example:</p>
+
+<pre>
+ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment);
+</pre>
+
+
+<h4 id="EventCallbacks">Creating event callbacks to the activity</h4>
+
+<p>In some cases, you might need a fragment to share events with the activity. A good way to do that
+is to define a callback interface inside the fragment and require that the host activity implement
+it. When the activity receives a callback through the interface, it can share the information with
+other fragments in the layout as necessary.</p>
+
+<p>For example, if a news application has two fragments in an activity&mdash;one to show a list of
+articles (fragment A) and another to display an article (fragment B)&mdash;then fragment A must tell
+the activity when a list item is selected so that it can tell fragment B to display the article. In
+this case, the {@code OnArticleSelectedListener} interface is declared inside fragment A:</p>
+
+<pre>
+public static class FragmentA extends ListFragment {
+ ...
+ // Container Activity must implement this interface
+ public interface OnArticleSelectedListener {
+ public void onArticleSelected(Uri articleUri);
+ }
+ ...
+}
+</pre>
+
+<p>Then the activity that hosts the fragment implements the {@code OnArticleSelectedListener}
+interface and
+overrides {@code onArticleSelected()} to notify fragment B of the event from fragment A. To ensure
+that the host activity implements this interface, fragment A's {@link
+android.app.Fragment#onAttach onAttach()} callback method (which the system calls when adding
+the fragment to the activity) instantiates an instance of {@code OnArticleSelectedListener} by
+casting the {@link android.app.Activity} that is passed into {@link android.app.Fragment#onAttach
+onAttach()}:</p>
+
+<pre>
+public static class FragmentA extends ListFragment {
+ OnArticleSelectedListener mListener;
+ ...
+ &#64;Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ try {
+ mListener = (OnArticleSelectedListener) activity;
+ } catch (ClassCastException e) {
+ throw new ClassCastException(activity.toString() + " must implement OnArticleSelectedListener");
+ }
+ }
+ ...
+}
+</pre>
+
+<p>If the activity has not implemented the interface, then the fragment throws a
+{@link java.lang.ClassCastException}.
+On success, the {@code mListener} member holds a reference to activity's implementation of
+{@code OnArticleSelectedListener}, so that fragment A can share events with the activity by calling
+methods defined by the {@code OnArticleSelectedListener} interface. For example, if fragment A is an
+extension of {@link android.app.ListFragment}, each time
+the user clicks a list item, the system calls {@link android.app.ListFragment#onListItemClick
+onListItemClick()} in the fragment, which then calls {@code onArticleSelected()} to share
+the event with the activity:</p>
+
+<pre>
+public static class FragmentA extends ListFragment {
+ OnArticleSelectedListener mListener;
+ ...
+ &#64;Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+ // Append the clicked item's row ID with the content provider Uri
+ Uri noteUri = ContentUris.{@link android.content.ContentUris#withAppendedId withAppendedId}(ArticleColumns.CONTENT_URI, id);
+ // Send the event and Uri to the host activity
+ mListener.onArticleSelected(noteUri);
+ }
+ ...
+}
+</pre>
+
+<p>The {@code id} parameter passed to {@link
+android.app.ListFragment#onListItemClick onListItemClick()} is the row ID of the clicked item,
+which the activity (or other fragment) uses to fetch the article from the application's {@link
+android.content.ContentProvider}.</p>
+
+<p><!--To see a complete implementation of this kind of callback interface, see the <a
+href="{@docRoot}resources/samples/NotePad/index.html">NotePad sample</a>. -->More information about
+using a content provider is available in the <a
+href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a> document.</p>
+
+
+
+<h3 id="ActionBar">Adding items to the Action Bar</h3>
+
+<p>Your fragments can contribute menu items to the activity's <a
+href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> (and, consequently, the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a>) by implementing
+{@link android.app.Fragment#onCreateOptionsMenu(Menu,MenuInflater) onCreateOptionsMenu()}. In order
+for this method to receive calls, however, you must call {@link
+android.app.Fragment#setHasOptionsMenu(boolean) setHasOptionsMenu()} during {@link
+android.app.Fragment#onCreate(Bundle) onCreate()}, to indicate that the fragment
+would like to add items to the Options Menu (otherwise, the fragment will not receive a call to
+{@link android.app.Fragment#onCreateOptionsMenu onCreateOptionsMenu()}).</p>
+
+<p>Any items that you then add to the Options Menu from the fragment are appended to the existing
+menu items. The fragment also receives callbacks to {@link
+android.app.Fragment#onOptionsItemSelected(MenuItem) onOptionsItemSelected()} when a menu item
+is selected.</p>
+
+<p>You can also register a view in your fragment layout to provide a context menu by calling {@link
+android.app.Fragment#registerForContextMenu(View) registerForContextMenu()}. When the user opens
+the context menu, the fragment receives a call to {@link
+android.app.Fragment#onCreateContextMenu(ContextMenu,View,ContextMenu.ContextMenuInfo)
+onCreateContextMenu()}. When the user selects an item, the fragment receives a call to {@link
+android.app.Fragment#onContextItemSelected(MenuItem) onContextItemSelected()}.</p>
+
+<p class="note"><strong>Note:</strong> Although your fragment receives an on-item-selected callback
+for each menu item it adds, the activity is first to receive the respective callback when the user
+selects a menu item. If the activity's implementation of the on-item-selected callback does not
+handle the selected item, then the event is passed to the fragment's callback. This is true for
+the Options Menu and context menus.</p>
+
+<p>For more information about menus, see <a href="{@docRoot}guide/topics/ui/menus.html">Creating
+Menus</a> and <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the Action Bar</a>.</p>
+
+
+
+
+<h2 id="Lifecycle">Handling the Fragment Lifecycle</h2>
+
+<div class="figure" style="width:403px">
+<img src="{@docRoot}images/activity_fragment_lifecycle.png" alt=""/>
+<p class="img-caption"><strong>Figure 3.</strong> The activity lifecycle's affect on the fragment
+lifecycle.</p>
+</div>
+
+<p>Managing the lifecycle of a fragment is a lot like managing the lifecycle of an activity. Like
+an activity, a fragment can exist in three states:</p>
+
+<dl>
+ <dt><i>Resumed</i></dt>
+ <dd>The fragment is visible in the running activity.</dd>
+
+ <dt><i>Paused</i></dt>
+ <dd>Another activity is in the foreground and has focus, but the activity in which this
+fragment lives is still visible (the foreground activity is partially transparent or doesn't
+cover the entire screen).</dd>
+
+ <dt><i>Stopped</i></dt>
+ <dd>The fragment is not visible. Either the host activity has been stopped or the
+fragment has been removed from the activity but added to the back stack. A stopped fragment is
+still alive (all state and member information is retained by the system). However, it is no longer
+visible to the user and will be killed if the activity is killed.</dd>
+</dl>
+
+<p>Also like an activity, you can retain the state of a fragment using a {@link
+android.os.Bundle}, in case the activity's process is killed and you need to restore the
+fragment state when the activity is recreated. You can save the state during the fragment's {@link
+android.app.Fragment#onSaveInstanceState onSaveInstanceState()} callback and restore it during
+either {@link android.app.Fragment#onCreate onCreate()}, {@link
+android.app.Fragment#onCreateView onCreateView()}, or {@link
+android.app.Fragment#onActivityCreated onActivityCreated()}. For more information about saving
+state, see the <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#SavingActivityState">Activities</a>
+document.</p>
+
+<p>The most significant difference in lifecycle between an activity and a fragment is how one is
+stored in its respective back stack. An activity is placed into a back stack of activities
+that's managed by the system when it's stopped, by default (so that the user can navigate back
+to it with the BACK key, as discussed in <a
+href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a>).
+However, a fragment is placed into a back stack managed by the host activity only when you
+explicitly request that the instance be saved by calling {@link
+android.app.FragmentTransaction#addToBackStack(String) addToBackStack()} during a transaction that
+removes the fragment.</p>
+
+<p>Otherwise, managing the fragment lifecycle is very similar to managing the activity
+lifecycle. So, the same practices for <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">managing the activity
+lifecycle</a> also apply to fragments. What you also need to understand, though, is how the life
+of the activity affects the life of the fragment.</p>
+
+
+<h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3>
+
+<p>The lifecycle of the activity in which the fragment lives directly affects the lifecycle of the
+fragment, such that each lifecycle callback for the activity results in a similar callback for each
+fragment. For example, when the activity receives {@link android.app.Activity#onPause}, each
+fragment in the activity receives {@link android.app.Fragment#onPause}.</p>
+
+<p>Fragments have a few extra lifecycle callbacks, however, that handle unique interaction with the
+activity in order to perform actions such as build and destroy the fragment's UI. These additional
+callback methods are:</p>
+
+<dl>
+ <dt>{@link android.app.Fragment#onAttach onAttach()}</dt>
+ <dd>Called when the fragment has been associated with the activity (the {@link
+android.app.Activity} is passed in here).</dd>
+ <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
+ <dd>Called to create the view hierarchy associated with the fragment.</dd>
+ <dt>{@link android.app.Fragment#onActivityCreated onActivityCreated()}</dt>
+ <dd>Called when the activity's {@link android.app.Activity#onCreate
+onCreate()} method has returned.</dd>
+ <dt>{@link android.app.Fragment#onDestroyView onDestroyView()}</dt>
+ <dd>Called when the view hierarchy associated with the fragment is being removed.</dd>
+ <dt>{@link android.app.Fragment#onDetach onDetach()}</dt>
+ <dd>Called when the fragment is being disassociated from the activity.</dd>
+</dl>
+
+<p>The flow of a fragment's lifecycle, as it is affected by its host activity, is illustrated
+by figure 3. In this figure, you can see how each successive state of the activity determines which
+callback methods a fragment may receive. For example, when the activity has received its {@link
+android.app.Activity#onCreate onCreate()} callback, a fragment in the activity receives no more than
+the {@link android.app.Fragment#onActivityCreated onActivityCreated()} callback.</p>
+
+<p>Once the activity reaches the resumed state, you can freely add and remove fragments to the
+activity. Thus, only while the activity is in the resumed state can the lifecycle of a fragment
+change independently.</p>
+
+<p>However, when the activity leaves the resumed state, the fragment again is pushed through its
+lifecycle by the activity.</p>
+
+
+
+
+<h2 id="Example">Example</h2>
+
+<p>To bring everything discussed in this document together, here's an example of an activity
+using two fragments to create a two-pane layout. The activity below includes one fragment to
+show a list of Shakespeare play titles and another to show a summary of the play when selected
+from the list. It also demonstrates how to provide different configurations of the fragments,
+based on the screen configuration.</p>
+
+<p class="note"><strong>Note:</strong> The complete source code for this activity is available in
+<a href="resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.html">{@code
+FragmentLayout.java}</a>.</p>
+
+<p>The main activity applies a layout in the usual way, during {@link
+android.app.Activity#onCreate onCreate()}:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java main}
+
+<p>The layout applied is {@code fragment_layout.xml}:</p>
+
+{@sample development/samples/ApiDemos/res/layout-land/fragment_layout.xml layout}
+
+<p>Using this layout, the system instantiates the {@code TitlesFragment} (which lists the play
+titles) as soon as the activity loads the layout, while the {@link android.widget.FrameLayout}
+(where the fragment for showing the play summary will go) consumes space on the right side of the
+screen, but remains empty at first. As you'll see below, it's not until the user selects an item
+from the list that a fragment is placed into the {@link android.widget.FrameLayout}.</p>
+
+<p>However, not all screen configurations are wide enough to show both the list of
+plays and the summary, side by side. So, the layout above is used only for the landscape
+screen configuration, by saving it at {@code res/layout-land/fragment_layout.xml}.</p>
+
+<p>Thus, when the screen is in portrait orientation, the system applies the following layout, which
+is saved at {@code res/layout/fragment_layout.xml}:</p>
+
+{@sample development/samples/ApiDemos/res/layout/fragment_layout.xml layout}
+
+<p>This layout includes only {@code TitlesFragment}. This means that, when the device is in
+portrait orientation, only the list of play titles is visible. So, when the user clicks a list
+item in this configuration, the application will start a new activity to show the summary,
+instead of loading a second fragment.</p>
+
+<p>Next, you can see how this is accomplished in the fragment classes. First is {@code
+TitlesFragment}, which shows the list of Shakespeare play titles. This fragment extends {@link
+android.app.ListFragment} and relies on it to handle most of the list view work.</p>
+
+<p>As you inspect this code, notice that there are two possible behaviors when the user clicks a
+list item: depending on which of the two layouts is active, it can either create and display a new
+fragment to show the details in the same activity (adding the fragment to the {@link
+android.widget.FrameLayout}), or start a new activity (where the fragment can be shown).</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java titles}
+
+<p>The second fragment, {@code DetailsFragment} shows the play summary for the item selected from
+the list from {@code TitlesFragment}:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java details}
+
+<p>Recall from the {@code TitlesFragment} class, that, if the user clicks a list item and the
+current layout does <em>not</em> include the {@code R.id.details} view (which is where the
+{@code DetailsFragment} belongs), then the application starts the {@code DetailsActivity}
+activity to display the content of the item.</p>
+
+<p>Here is the {@code DetailsActivity}, which simply embeds the {@code DetailsFragment} to display
+the selected play summary when the screen is in portrait orientation:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
+details_activity}
+
+<p>Notice that this activity finishes itself if the configuration is landscape, so that the main
+activity can take over and display the {@code DetailsFragment} alongside the {@code TitlesFragment}.
+This can happen if the user begins the {@code DetailsActivity} while in portrait orientation, but
+then rotates to landscape (which restarts the current activity).</p>
+
+
+<p>For more samples using fragments (and complete source files for this example),
+see the sample code available in <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">
+ApiDemos</a> (available for download from the <a
+href="{@docRoot}resources/samples/get.html">Samples SDK component</a>).</p>
+
+
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd
index 44d75c19dee5..c17fc3cc9493 100644
--- a/docs/html/guide/topics/ui/actionbar.jd
+++ b/docs/html/guide/topics/ui/actionbar.jd
@@ -53,7 +53,7 @@ href="{@docRoot}guide/topics/ui/menus.html#OptionsMenu">Options Menu</a> as "act
items"&mdash;providing instant access to key user actions. (Menu items not appearing as action
items are placed in the Overflow Menu, revealed by a drop-down in the Action Bar.)</li>
<li>Provide tabs for navigating between <a
-href="{@docRoot}guide/topics/fragments/index.html">fragments</a>.</li>
+href="{@docRoot}guide/topics/fundamentals/fragments.html">fragments</a>.</li>
<li>Provide drop-down navigation items.</li>
<li>Provide interactive "action views" in place of action items.</li>
<li>Use the application logo as a "return home" or "up" navigation action.</li>
@@ -432,7 +432,7 @@ tab.</p>
the state of each fragment as necessary, so when the user switches fragments with the tabs,
then returns to a previous fragment, it appears the way they left. For information about saving
the state of your fragment, see the <a
-href="{@docRoot}guide/topics/fragments/index.html">Fragments</a> developer guide.</p>
+href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> developer guide.</p>
diff --git a/docs/html/images/fundamentals/fragments.png b/docs/html/images/fundamentals/fragments.png
new file mode 100644
index 000000000000..b3b7b23073e7
--- /dev/null
+++ b/docs/html/images/fundamentals/fragments.png
Binary files differ
diff --git a/docs/html/offline.jd b/docs/html/offline.jd
index fe70d50323c3..1064a9924ef8 100644
--- a/docs/html/offline.jd
+++ b/docs/html/offline.jd
@@ -2,48 +2,59 @@ home=true
page.title=Welcome
@jd:body
+<style type="text/css">
+#qv h2 {
+ font-size:1.5em;
+ font-weight:bold;
+ margin:12px 0 .5em 0;
+ padding:5px;
+ color:#7BB026;
+ border:none;
+}
+#qv ul li {
+ padding: 0 5px 1em 0;
+}
+</style>
<div id="mainBodyFluid">
<h1>Welcome to the Android SDK!</h1>
-<img src="{@docRoot}assets/images/home/sdk-large.png" style="float:right; margin:-2em 3em 3em;" />
-
-<h3>If you've downloaded the Android SDK for the first time...</h3>
+<div id="qv-wrapper">
+<div id="qv">
+ <h2>Get Started</h2>
+ <ul>
+ <li>Create a <a href="{@docRoot}resources/tutorials/hello-world.html">Hello World</a>
+application</li>
+ <li>Read <a href="{@docRoot}resources/browser.html?tag=sample">Sample Code</a>,
+especially <a href="{@docRoot}resources/samples/ApiDemos/index.html">API Demos</a></li>
+ <li>Read the <a href="{@docRoot}guide/topics/fundamentals/index.html">Application
+Fundamentals</a></li>
+ <li>Read the <a href="{@docRoot}guide/developing/index.html">Overview</a> for using the SDK
+tools</li>
+ </ul>
+</div>
+</div>
-<p>Follow the online guide to
-<a href="{@docRoot}sdk/installing.html">Installing
-the Android SDK</a>, which will help you setup your development environment
-(including the Android Development Tools plugin for Eclipse)
-so you can start developing Android apps.</p>
+<h3>If you've downloaded the Android SDK for the first time</h3>
-<p>Once your environment is setup, look at the
-<a href="{@docRoot}sdk/installing.html#NextSteps">Next
-Steps</a> for some suggestions on how to begin learning about Android.</p>
+<p>Follow the guide to <a href="{@docRoot}sdk/installing.html">Installing the Android SDK</a>, which
+will help you setup your development environment.</p>
-<h3>If you've just installed new SDK components using the <em>SDK and AVD Manager</em>...</h3>
+<h3>If you've installed new SDK components using the SDK and AVD Manager</h3>
<p>There's no additional setup.</p>
-<p>Newly installed Android platforms are automatically saved in the
-<code><em>&lt;sdk_dir>/</em>platforms/</code> directory of your existing SDK;
-new add-ons are saved in the <code><em>&lt;sdk_dir>/</em>add-ons/</code>
-directory; and new documentation is saved in the existing
-<code><em>&lt;sdk_dir>/</em>docs/</code> directory (old docs are replaced).</p>
-
+<p>New Android platforms are saved in the <code>&lt;sdk>/platforms/</code> directory of
+your existing SDK and new add-ons are saved in the <code>&lt;sdk>/add-ons/</code> directory.</p>
-<hr style="margin:2em 0;" />
-<p>Note that you are currently viewing a local, offline version of the
-Android developer documentation. The offline documentation offers almost all the same
-content and features as the online documentation. Because some features
-such as search and videos are network-based, not everything will work if you
-are not connected to the Internet.</p>
+<div class="note">
+<p><strong>Note:</strong> You are currently viewing the offline version of the Android developer
+documentation. Because some features such as search and videos are network-based, not everything
+will work if you are not connected to the Internet. Additionally, the online version may contain
+more recently updated documents.</p>
-<p>For the most current documentation and a fully-functional experience, please visit:</p>
-<p style="margin-left:2em;">
-<a href="http://developer.android.com">http://developer.android.com</a></strong>.
+<p>For the latest documentation, please visit
+<b><a href="http://developer.android.com">developer.android.com</a></b>.
</p>
-
-
-
</div>
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index 9e1ff9c710b5..2780135a3fd8 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -35,18 +35,20 @@
</a></li>
</ul>
- </li><?cs
- /if ?>
- <?cs
+ </li>
+ <?cs /if ?><?cs
if:sdk.preview ?>
- <li><h2>Android Preview SDK</h2></li>
+ <li><h2>Android 3.0 Preview SDK</h2>
<ul>
- <li><a href="<?cs var:toroot ?>sdk/preview/features.html">Introduction
-to Honeycomb</a></li>
-<!--
- <li><a href="<?cs var:toroot ?>sdk/preview/installing.html">Getting
-Started</a></li>
--->
+ <li><a href="<?cs var:toroot ?>sdk/preview/start.html">Getting Started</a> <span class="new">new!</span></li>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>sdk/preview/platform.html">
+ <span class="en">Android 3.0 Platform</span></a> <span class="new">new!</span></div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>sdk/preview/highlights.html">Platform Highlights</a></li>
+ <li><a href="<?cs var:toroot ?>sdk/api_diff/honeycomb/changes.html">API Differences Report &raquo;</a></li>
+ </ul>
+ </li>
</ul>
</li><?cs
/if ?>
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index a8efd00f3258..e67ceeda9e74 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -53,6 +53,7 @@ public final class Bitmap implements Parcelable {
*/
public byte[] mBuffer;
+ @SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) // Keep to finalize native resources
private final BitmapFinalizer mFinalizer;
private final boolean mIsMutable;
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 8309f7abe169..cffee5fd4e9c 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -64,6 +64,14 @@ public class BitmapFactory {
public Bitmap inBitmap;
/**
+ * If set, decode methods will always return a mutable Bitmap instead of
+ * an immutable one. This can be used for instance to programmatically apply
+ * effects to a Bitmap loaded through BitmapFactory.
+ */
+ @SuppressWarnings({"UnusedDeclaration"}) // used in native code
+ public boolean inMutable;
+
+ /**
* If set to true, the decoder will return null (no bitmap), but
* the out... fields will still be set, allowing the caller to query
* the bitmap without having to allocate the memory for its pixels.
@@ -523,7 +531,7 @@ public class BitmapFactory {
}
bm.setDensity(targetDensity);
}
-
+
return bm;
}
@@ -556,11 +564,22 @@ public class BitmapFactory {
* @return the decoded bitmap, or null
*/
public static Bitmap decodeFileDescriptor(FileDescriptor fd, Rect outPadding, Options opts) {
- Bitmap bm = nativeDecodeFileDescriptor(fd, outPadding, opts);
- if (bm == null && opts != null && opts.inBitmap != null) {
- throw new IllegalArgumentException("Problem decoding into existing bitmap");
+ if (nativeIsSeekable(fd)) {
+ Bitmap bm = nativeDecodeFileDescriptor(fd, outPadding, opts);
+ if (bm == null && opts != null && opts.inBitmap != null) {
+ throw new IllegalArgumentException("Problem decoding into existing bitmap");
+ }
+ return finishDecode(bm, outPadding, opts);
+ } else {
+ FileInputStream fis = new FileInputStream(fd);
+ try {
+ return decodeStream(fis, outPadding, opts);
+ } finally {
+ try {
+ fis.close();
+ } catch (Throwable t) {/* ignore */}
+ }
}
- return finishDecode(bm, outPadding, opts);
}
/**
@@ -607,4 +626,5 @@ public class BitmapFactory {
private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts);
private static native byte[] nativeScaleNinePatch(byte[] chunk, float scale, Rect pad);
+ private static native boolean nativeIsSeekable(FileDescriptor fd);
}
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 852aabf5858f..1789891d73e5 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -121,6 +121,58 @@ public class Allocation extends BaseObj {
mType = t;
}
+ private void validateIsInt32() {
+ if ((mType.mElement.mType == Element.DataType.SIGNED_32) ||
+ (mType.mElement.mType == Element.DataType.UNSIGNED_32)) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "32 bit integer source does not match allocation type " + mType.mElement.mType);
+ }
+
+ private void validateIsInt16() {
+ if ((mType.mElement.mType == Element.DataType.SIGNED_16) ||
+ (mType.mElement.mType == Element.DataType.UNSIGNED_16)) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "16 bit integer source does not match allocation type " + mType.mElement.mType);
+ }
+
+ private void validateIsInt8() {
+ if ((mType.mElement.mType == Element.DataType.SIGNED_8) ||
+ (mType.mElement.mType == Element.DataType.UNSIGNED_8)) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "8 bit integer source does not match allocation type " + mType.mElement.mType);
+ }
+
+ private void validateIsFloat32() {
+ if (mType.mElement.mType == Element.DataType.FLOAT_32) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "32 bit float source does not match allocation type " + mType.mElement.mType);
+ }
+
+ private void validateIsObject() {
+ if ((mType.mElement.mType == Element.DataType.RS_ELEMENT) ||
+ (mType.mElement.mType == Element.DataType.RS_TYPE) ||
+ (mType.mElement.mType == Element.DataType.RS_ALLOCATION) ||
+ (mType.mElement.mType == Element.DataType.RS_SAMPLER) ||
+ (mType.mElement.mType == Element.DataType.RS_SCRIPT) ||
+ (mType.mElement.mType == Element.DataType.RS_MESH) ||
+ (mType.mElement.mType == Element.DataType.RS_PROGRAM_FRAGMENT) ||
+ (mType.mElement.mType == Element.DataType.RS_PROGRAM_VERTEX) ||
+ (mType.mElement.mType == Element.DataType.RS_PROGRAM_RASTER) ||
+ (mType.mElement.mType == Element.DataType.RS_PROGRAM_STORE)) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "Object source does not match allocation type " + mType.mElement.mType);
+ }
+
@Override
void updateFromNative() {
super.updateFromNative();
@@ -151,6 +203,7 @@ public class Allocation extends BaseObj {
public void copyFrom(BaseObj[] d) {
mRS.validate();
+ validateIsObject();
if (d.length != mType.getCount()) {
throw new RSIllegalArgumentException("Array size mismatch, allocation sizeX = " +
mType.getCount() + ", array length = " + d.length);
@@ -258,7 +311,6 @@ public class Allocation extends BaseObj {
mRS.nAllocationData1D(getID(), xoff, 0, count, data, data.length);
}
-
/**
* This is only intended to be used by auto-generate code reflected from the
* renderscript script files.
@@ -317,27 +369,44 @@ public class Allocation extends BaseObj {
mRS.nAllocationGenerateMipmaps(getID());
}
- public void copy1DRangeFrom(int off, int count, int[] d) {
+ 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);
}
- public void copy1DRangeFrom(int off, int count, short[] d) {
+ 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);
}
- public void copy1DRangeFrom(int off, int count, byte[] d) {
+ 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);
}
- public void copy1DRangeFrom(int off, int count, float[] d) {
+ 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);
}
+ public void copy1DRangeFrom(int off, int count, int[] d) {
+ validateIsInt32();
+ copy1DRangeFromUnchecked(off, count, d);
+ }
+ public void copy1DRangeFrom(int off, int count, short[] d) {
+ validateIsInt16();
+ copy1DRangeFromUnchecked(off, count, d);
+ }
+ public void copy1DRangeFrom(int off, int count, byte[] d) {
+ validateIsInt8();
+ copy1DRangeFromUnchecked(off, count, d);
+ }
+ public void copy1DRangeFrom(int off, int count, float[] d) {
+ validateIsFloat32();
+ copy1DRangeFromUnchecked(off, count, d);
+ }
+
private void validate2DRange(int xoff, int yoff, int w, int h) {
if (xoff < 0 || yoff < 0) {
throw new RSIllegalArgumentException("Offset cannot be negative.");
@@ -411,21 +480,25 @@ public class Allocation extends BaseObj {
}
public void copyTo(byte[] d) {
+ validateIsInt8();
mRS.validate();
mRS.nAllocationRead(getID(), d);
}
public void copyTo(short[] d) {
+ validateIsInt16();
mRS.validate();
mRS.nAllocationRead(getID(), d);
}
public void copyTo(int[] d) {
+ validateIsInt32();
mRS.validate();
mRS.nAllocationRead(getID(), d);
}
public void copyTo(float[] d) {
+ validateIsFloat32();
mRS.validate();
mRS.nAllocationRead(getID(), d);
}
diff --git a/graphics/java/android/renderscript/FileA3D.java b/graphics/java/android/renderscript/FileA3D.java
index fe3971a5e116..79ee99758e45 100644
--- a/graphics/java/android/renderscript/FileA3D.java
+++ b/graphics/java/android/renderscript/FileA3D.java
@@ -46,7 +46,13 @@ public class FileA3D extends BaseObj {
**/
public enum EntryType {
+ /**
+ * Unknown or or invalid object, nothing will be loaded
+ **/
UNKNOWN (0),
+ /**
+ * Renderscript Mesh object
+ **/
MESH (1);
int mID;
@@ -74,14 +80,20 @@ public class FileA3D extends BaseObj {
BaseObj mLoadedObj;
/**
+ * Returns the name of a renderscript object the index entry
+ * describes
+ *
* @return name of a renderscript object the index entry
- * describes
+ * describes
+ *
*/
public String getName() {
return mName;
}
/**
+ * Returns the type of a renderscript object the index entry
+ * describes
* @return type of a renderscript object the index entry
* describes
*/
@@ -90,7 +102,8 @@ public class FileA3D extends BaseObj {
}
/**
- * @return renderscript object described by the entry
+ * Used to load the object described by the index entry
+ * @return base renderscript object described by the entry
*/
public BaseObj getObject() {
mRS.validate();
@@ -99,6 +112,9 @@ public class FileA3D extends BaseObj {
}
/**
+ * Used to load the mesh described by the index entry, object
+ * described by the index entry must be a renderscript mesh
+ *
* @return renderscript mesh object described by the entry
*/
public Mesh getMesh() {
@@ -166,7 +182,9 @@ public class FileA3D extends BaseObj {
}
/**
- * @return the numberof objects stored inside a FileA3D
+ * Returns the number of objects stored inside the a3d file
+ *
+ * @return the number of objects stored inside the a3d file
*/
public int getIndexEntryCount() {
if(mFileEntries == null) {
@@ -180,6 +198,8 @@ public class FileA3D extends BaseObj {
* FileA3D
*
* @param index number of the entry from the list to return
+ *
+ * @return entry in the a3d file described by the index
*/
public IndexEntry getIndexEntry(int index) {
if(getIndexEntryCount() == 0 || index < 0 || index >= mFileEntries.length) {
@@ -195,6 +215,7 @@ public class FileA3D extends BaseObj {
* @param mgr asset manager used to load asset
* @param path location of the file to load
*
+ * @return a3d file containing renderscript objects
*/
static public FileA3D createFromAsset(RenderScript rs, AssetManager mgr, String path) {
rs.validate();
@@ -214,6 +235,7 @@ public class FileA3D extends BaseObj {
* @param rs Context to which the object will belong.
* @param path location of the file to load
*
+ * @return a3d file containing renderscript objects
*/
static public FileA3D createFromFile(RenderScript rs, String path) {
int fileId = rs.nFileA3DCreateFromFile(path);
@@ -232,6 +254,7 @@ public class FileA3D extends BaseObj {
* @param rs Context to which the object will belong.
* @param path location of the file to load
*
+ * @return a3d file containing renderscript objects
*/
static public FileA3D createFromFile(RenderScript rs, File path) {
return createFromFile(rs, path.getAbsolutePath());
@@ -244,6 +267,7 @@ public class FileA3D extends BaseObj {
* @param res resource manager used for loading
* @param id resource to create FileA3D from
*
+ * @return a3d file containing renderscript objects
*/
static public FileA3D createFromResource(RenderScript rs, Resources res, int id) {
diff --git a/graphics/java/android/renderscript/Matrix2f.java b/graphics/java/android/renderscript/Matrix2f.java
index 2fffe8ceebb1..c9a0ea8ab04b 100644
--- a/graphics/java/android/renderscript/Matrix2f.java
+++ b/graphics/java/android/renderscript/Matrix2f.java
@@ -26,28 +26,61 @@ import android.util.Log;
**/
public class Matrix2f {
+ /**
+ * Creates a new identity 2x2 matrix
+ */
public Matrix2f() {
mMat = new float[4];
loadIdentity();
}
+ /**
+ * Creates a new matrix and sets its values from the given
+ * parameter
+ *
+ * @param dataArray values to set the matrix to, must be 4
+ * floats long
+ */
public Matrix2f(float[] dataArray) {
mMat = new float[2];
System.arraycopy(dataArray, 0, mMat, 0, mMat.length);
}
+ /**
+ * Return a reference to the internal array representing matrix
+ * values. Modifying this array will also change the matrix
+ *
+ * @return internal array representing the matrix
+ */
public float[] getArray() {
return mMat;
}
+ /**
+ * Returns the value for a given row and column
+ *
+ * @param i row of the value to return
+ * @param j column of the value to return
+ *
+ * @return value in the ith row and jth column
+ */
public float get(int i, int j) {
return mMat[i*2 + j];
}
+ /**
+ * Sets the value for a given row and column
+ *
+ * @param i row of the value to set
+ * @param j column of the value to set
+ */
public void set(int i, int j, float v) {
mMat[i*2 + j] = v;
}
+ /**
+ * Sets the matrix values to identity
+ */
public void loadIdentity() {
mMat[0] = 1;
mMat[1] = 0;
@@ -56,10 +89,20 @@ public class Matrix2f {
mMat[3] = 1;
}
+ /**
+ * Sets the values of the matrix to those of the parameter
+ *
+ * @param src matrix to load the values from
+ */
public void load(Matrix2f src) {
System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
}
+ /**
+ * Sets current values to be a rotation matrix of given angle
+ *
+ * @param rot rotation angle
+ */
public void loadRotate(float rot) {
float c, s;
rot *= (float)(java.lang.Math.PI / 180.0f);
@@ -71,11 +114,25 @@ public class Matrix2f {
mMat[3] = c;
}
+ /**
+ * Sets current values to be a scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ */
public void loadScale(float x, float y) {
loadIdentity();
mMat[0] = x;
mMat[3] = y;
}
+
+ /**
+ * Sets current values to be the result of multiplying two given
+ * matrices
+ *
+ * @param lhs left hand side matrix
+ * @param rhs right hand side matrix
+ */
public void loadMultiply(Matrix2f lhs, Matrix2f rhs) {
for (int i=0 ; i<2 ; i++) {
float ri0 = 0;
@@ -90,21 +147,42 @@ public class Matrix2f {
}
}
+ /**
+ * Post-multiplies the current matrix by a given parameter
+ *
+ * @param rhs right hand side to multiply by
+ */
public void multiply(Matrix2f rhs) {
Matrix2f tmp = new Matrix2f();
tmp.loadMultiply(this, rhs);
load(tmp);
}
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * rotation matrix of given angle
+ *
+ * @param rot angle of rotation
+ */
public void rotate(float rot) {
Matrix2f tmp = new Matrix2f();
tmp.loadRotate(rot);
multiply(tmp);
}
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ */
public void scale(float x, float y) {
Matrix2f tmp = new Matrix2f();
tmp.loadScale(x, y);
multiply(tmp);
}
+ /**
+ * Sets the current matrix to its transpose
+ */
public void transpose() {
float temp = mMat[1];
mMat[1] = mMat[2];
diff --git a/graphics/java/android/renderscript/Matrix3f.java b/graphics/java/android/renderscript/Matrix3f.java
index e4c5e00cdb10..2ec8c625f079 100644
--- a/graphics/java/android/renderscript/Matrix3f.java
+++ b/graphics/java/android/renderscript/Matrix3f.java
@@ -26,28 +26,61 @@ import android.util.Log;
**/
public class Matrix3f {
+ /**
+ * Creates a new identity 3x3 matrix
+ */
public Matrix3f() {
mMat = new float[9];
loadIdentity();
}
+ /**
+ * Creates a new matrix and sets its values from the given
+ * parameter
+ *
+ * @param dataArray values to set the matrix to, must be 9
+ * floats long
+ */
public Matrix3f(float[] dataArray) {
mMat = new float[9];
System.arraycopy(dataArray, 0, mMat, 0, mMat.length);
}
+ /**
+ * Return a reference to the internal array representing matrix
+ * values. Modifying this array will also change the matrix
+ *
+ * @return internal array representing the matrix
+ */
public float[] getArray() {
return mMat;
}
+ /**
+ * Returns the value for a given row and column
+ *
+ * @param i row of the value to return
+ * @param j column of the value to return
+ *
+ * @return value in the ith row and jth column
+ */
public float get(int i, int j) {
return mMat[i*3 + j];
}
+ /**
+ * Sets the value for a given row and column
+ *
+ * @param i row of the value to set
+ * @param j column of the value to set
+ */
public void set(int i, int j, float v) {
mMat[i*3 + j] = v;
}
+ /**
+ * Sets the matrix values to identity
+ */
public void loadIdentity() {
mMat[0] = 1;
mMat[1] = 0;
@@ -62,10 +95,24 @@ public class Matrix3f {
mMat[8] = 1;
}
+ /**
+ * Sets the values of the matrix to those of the parameter
+ *
+ * @param src matrix to load the values from
+ */
public void load(Matrix3f src) {
System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
}
+ /**
+ * Sets current values to be a rotation matrix of certain angle
+ * about a given axis
+ *
+ * @param rot angle of rotation
+ * @param x rotation axis x
+ * @param y rotation axis y
+ * @param z rotation axis z
+ */
public void loadRotate(float rot, float x, float y, float z) {
float c, s;
rot *= (float)(java.lang.Math.PI / 180.0f);
@@ -97,7 +144,13 @@ public class Matrix3f {
mMat[8] = z*z*nc + c;
}
+ /**
+ * Makes the upper 2x2 a rotation matrix of the given angle
+ *
+ * @param rot rotation angle
+ */
public void loadRotate(float rot) {
+ loadIdentity();
float c, s;
rot *= (float)(java.lang.Math.PI / 180.0f);
c = (float)java.lang.Math.cos(rot);
@@ -108,12 +161,25 @@ public class Matrix3f {
mMat[4] = c;
}
+ /**
+ * Makes the upper 2x2 a scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ */
public void loadScale(float x, float y) {
loadIdentity();
mMat[0] = x;
mMat[4] = y;
}
+ /**
+ * Sets current values to be a scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ * @param z scale component z
+ */
public void loadScale(float x, float y, float z) {
loadIdentity();
mMat[0] = x;
@@ -121,12 +187,26 @@ public class Matrix3f {
mMat[8] = z;
}
+ /**
+ * Sets current values to be a translation matrix of given
+ * dimensions
+ *
+ * @param x translation component x
+ * @param y translation component y
+ */
public void loadTranslate(float x, float y) {
loadIdentity();
mMat[6] = x;
mMat[7] = y;
}
+ /**
+ * Sets current values to be the result of multiplying two given
+ * matrices
+ *
+ * @param lhs left hand side matrix
+ * @param rhs right hand side matrix
+ */
public void loadMultiply(Matrix3f lhs, Matrix3f rhs) {
for (int i=0 ; i<3 ; i++) {
float ri0 = 0;
@@ -144,36 +224,87 @@ public class Matrix3f {
}
}
+ /**
+ * Post-multiplies the current matrix by a given parameter
+ *
+ * @param rhs right hand side to multiply by
+ */
public void multiply(Matrix3f rhs) {
Matrix3f tmp = new Matrix3f();
tmp.loadMultiply(this, rhs);
load(tmp);
}
+
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * rotation matrix of certain angle about a given axis
+ *
+ * @param rot angle of rotation
+ * @param x rotation axis x
+ * @param y rotation axis y
+ * @param z rotation axis z
+ */
public void rotate(float rot, float x, float y, float z) {
Matrix3f tmp = new Matrix3f();
tmp.loadRotate(rot, x, y, z);
multiply(tmp);
}
+
+ /**
+ * Modifies the upper 2x2 of the current matrix by
+ * post-multiplying it with a rotation matrix of given angle
+ *
+ * @param rot angle of rotation
+ */
public void rotate(float rot) {
Matrix3f tmp = new Matrix3f();
tmp.loadRotate(rot);
multiply(tmp);
}
+
+ /**
+ * Modifies the upper 2x2 of the current matrix by
+ * post-multiplying it with a scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ */
public void scale(float x, float y) {
Matrix3f tmp = new Matrix3f();
tmp.loadScale(x, y);
multiply(tmp);
}
+
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ * @param z scale component z
+ */
public void scale(float x, float y, float z) {
Matrix3f tmp = new Matrix3f();
tmp.loadScale(x, y, z);
multiply(tmp);
}
+
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * translation matrix of given dimensions
+ *
+ * @param x translation component x
+ * @param y translation component y
+ */
public void translate(float x, float y) {
Matrix3f tmp = new Matrix3f();
tmp.loadTranslate(x, y);
multiply(tmp);
}
+
+ /**
+ * Sets the current matrix to its transpose
+ */
public void transpose() {
for(int i = 0; i < 2; ++i) {
for(int j = i + 1; j < 3; ++j) {
diff --git a/graphics/java/android/renderscript/Matrix4f.java b/graphics/java/android/renderscript/Matrix4f.java
index ec07cd5b7b0e..2afd72e6f49b 100644
--- a/graphics/java/android/renderscript/Matrix4f.java
+++ b/graphics/java/android/renderscript/Matrix4f.java
@@ -26,28 +26,61 @@ import android.util.Log;
**/
public class Matrix4f {
+ /**
+ * Creates a new identity 4x4 matrix
+ */
public Matrix4f() {
mMat = new float[16];
loadIdentity();
}
+ /**
+ * Creates a new matrix and sets its values from the given
+ * parameter
+ *
+ * @param dataArray values to set the matrix to, must be 16
+ * floats long
+ */
public Matrix4f(float[] dataArray) {
mMat = new float[16];
System.arraycopy(dataArray, 0, mMat, 0, mMat.length);
}
+ /**
+ * Return a reference to the internal array representing matrix
+ * values. Modifying this array will also change the matrix
+ *
+ * @return internal array representing the matrix
+ */
public float[] getArray() {
return mMat;
}
+ /**
+ * Returns the value for a given row and column
+ *
+ * @param i row of the value to return
+ * @param j column of the value to return
+ *
+ * @return value in the ith row and jth column
+ */
public float get(int i, int j) {
return mMat[i*4 + j];
}
+ /**
+ * Sets the value for a given row and column
+ *
+ * @param i row of the value to set
+ * @param j column of the value to set
+ */
public void set(int i, int j, float v) {
mMat[i*4 + j] = v;
}
+ /**
+ * Sets the matrix values to identity
+ */
public void loadIdentity() {
mMat[0] = 1;
mMat[1] = 0;
@@ -70,10 +103,24 @@ public class Matrix4f {
mMat[15] = 1;
}
+ /**
+ * Sets the values of the matrix to those of the parameter
+ *
+ * @param src matrix to load the values from
+ */
public void load(Matrix4f src) {
System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
}
+ /**
+ * Sets current values to be a rotation matrix of certain angle
+ * about a given axis
+ *
+ * @param rot angle of rotation
+ * @param x rotation axis x
+ * @param y rotation axis y
+ * @param z rotation axis z
+ */
public void loadRotate(float rot, float x, float y, float z) {
float c, s;
mMat[3] = 0;
@@ -112,6 +159,13 @@ public class Matrix4f {
mMat[10] = z*z*nc + c;
}
+ /**
+ * Sets current values to be a scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ * @param z scale component z
+ */
public void loadScale(float x, float y, float z) {
loadIdentity();
mMat[0] = x;
@@ -119,6 +173,14 @@ public class Matrix4f {
mMat[10] = z;
}
+ /**
+ * Sets current values to be a translation matrix of given
+ * dimensions
+ *
+ * @param x translation component x
+ * @param y translation component y
+ * @param z translation component z
+ */
public void loadTranslate(float x, float y, float z) {
loadIdentity();
mMat[12] = x;
@@ -126,6 +188,13 @@ public class Matrix4f {
mMat[14] = z;
}
+ /**
+ * Sets current values to be the result of multiplying two given
+ * matrices
+ *
+ * @param lhs left hand side matrix
+ * @param rhs right hand side matrix
+ */
public void loadMultiply(Matrix4f lhs, Matrix4f rhs) {
for (int i=0 ; i<4 ; i++) {
float ri0 = 0;
@@ -146,6 +215,16 @@ public class Matrix4f {
}
}
+ /**
+ * Set current values to be an orthographic projection matrix
+ *
+ * @param l location of the left vertical clipping plane
+ * @param r location of the right vertical clipping plane
+ * @param b location of the bottom horizontal clipping plane
+ * @param t location of the top horizontal clipping plane
+ * @param n location of the near clipping plane
+ * @param f location of the far clipping plane
+ */
public void loadOrtho(float l, float r, float b, float t, float n, float f) {
loadIdentity();
mMat[0] = 2 / (r - l);
@@ -156,10 +235,31 @@ public class Matrix4f {
mMat[14]= -(f + n) / (f - n);
}
+ /**
+ * Set current values to be an orthographic projection matrix
+ * with the right and bottom clipping planes set to the given
+ * values. Left and top clipping planes are set to 0. Near and
+ * far are set to -1, 1 respectively
+ *
+ * @param w location of the right vertical clipping plane
+ * @param h location of the bottom horizontal clipping plane
+ *
+ */
public void loadOrthoWindow(int w, int h) {
loadOrtho(0,w, h,0, -1,1);
}
+ /**
+ * Sets current values to be a perspective projection matrix
+ *
+ * @param l location of the left vertical clipping plane
+ * @param r location of the right vertical clipping plane
+ * @param b location of the bottom horizontal clipping plane
+ * @param t location of the top horizontal clipping plane
+ * @param n location of the near clipping plane, must be positive
+ * @param f location of the far clipping plane, must be positive
+ *
+ */
public void loadFrustum(float l, float r, float b, float t, float n, float f) {
loadIdentity();
mMat[0] = 2 * n / (r - l);
@@ -172,6 +272,14 @@ public class Matrix4f {
mMat[15]= 0;
}
+ /**
+ * Sets current values to be a perspective projection matrix
+ *
+ * @param fovy vertical field of view angle in degrees
+ * @param aspect aspect ratio of the screen
+ * @param near near cliping plane, must be positive
+ * @param far far clipping plane, must be positive
+ */
public void loadPerspective(float fovy, float aspect, float near, float far) {
float top = near * (float)Math.tan((float) (fovy * Math.PI / 360.0f));
float bottom = -top;
@@ -180,6 +288,14 @@ public class Matrix4f {
loadFrustum(left, right, bottom, top, near, far);
}
+ /**
+ * Helper function to set the current values to a perspective
+ * projection matrix with aspect ratio defined by the parameters
+ * and (near, far), (bottom, top) mapping to (-1, 1) at z = 0
+ *
+ * @param w screen width
+ * @param h screen height
+ */
public void loadProjectionNormalized(int w, int h) {
// range -1,1 in the narrow axis at z = 0.
Matrix4f m1 = new Matrix4f();
@@ -205,22 +321,53 @@ public class Matrix4f {
load(m1);
}
-
+ /**
+ * Post-multiplies the current matrix by a given parameter
+ *
+ * @param rhs right hand side to multiply by
+ */
public void multiply(Matrix4f rhs) {
Matrix4f tmp = new Matrix4f();
tmp.loadMultiply(this, rhs);
load(tmp);
}
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * rotation matrix of certain angle about a given axis
+ *
+ * @param rot angle of rotation
+ * @param x rotation axis x
+ * @param y rotation axis y
+ * @param z rotation axis z
+ */
public void rotate(float rot, float x, float y, float z) {
Matrix4f tmp = new Matrix4f();
tmp.loadRotate(rot, x, y, z);
multiply(tmp);
}
+
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * scale matrix of given dimensions
+ *
+ * @param x scale component x
+ * @param y scale component y
+ * @param z scale component z
+ */
public void scale(float x, float y, float z) {
Matrix4f tmp = new Matrix4f();
tmp.loadScale(x, y, z);
multiply(tmp);
}
+
+ /**
+ * Modifies the current matrix by post-multiplying it with a
+ * translation matrix of given dimensions
+ *
+ * @param x translation component x
+ * @param y translation component y
+ * @param z translation component z
+ */
public void translate(float x, float y, float z) {
Matrix4f tmp = new Matrix4f();
tmp.loadTranslate(x, y, z);
@@ -245,6 +392,9 @@ public class Matrix4f {
return cofactor;
}
+ /**
+ * Sets the current matrix to its inverse
+ */
public boolean inverse() {
Matrix4f result = new Matrix4f();
@@ -271,6 +421,9 @@ public class Matrix4f {
return true;
}
+ /**
+ * Sets the current matrix to its inverse transpose
+ */
public boolean inverseTranspose() {
Matrix4f result = new Matrix4f();
@@ -296,6 +449,9 @@ public class Matrix4f {
return true;
}
+ /**
+ * Sets the current matrix to its transpose
+ */
public void transpose() {
for(int i = 0; i < 3; ++i) {
for(int j = i + 1; j < 4; ++j) {
@@ -308,8 +464,3 @@ public class Matrix4f {
final float[] mMat;
}
-
-
-
-
-
diff --git a/graphics/java/android/renderscript/Mesh.java b/graphics/java/android/renderscript/Mesh.java
index fcf817876080..7269cea76ecc 100644
--- a/graphics/java/android/renderscript/Mesh.java
+++ b/graphics/java/android/renderscript/Mesh.java
@@ -46,11 +46,32 @@ public class Mesh extends BaseObj {
*
**/
public enum Primitive {
+ /**
+ * Vertex data will be rendered as a series of points
+ */
POINT (0),
+ /**
+ * Vertex pairs will be rendered as lines
+ */
LINE (1),
+ /**
+ * Vertex data will be rendered as a connected line strip
+ */
LINE_STRIP (2),
+ /**
+ * Vertices will be rendered as individual triangles
+ */
TRIANGLE (3),
+ /**
+ * Vertices will be rendered as a connected triangle strip
+ * defined by the first three vertices with each additional
+ * triangle defined by a new vertex
+ */
TRIANGLE_STRIP (4),
+ /**
+ * Vertices will be rendered as a sequence of triangles that all
+ * share first vertex as the origin
+ */
TRIANGLE_FAN (5);
int mID;
@@ -733,14 +754,14 @@ public class Mesh extends BaseObj {
Mesh sm = smb.create();
- sm.getVertexAllocation(0).copyFrom(mVtxData);
+ sm.getVertexAllocation(0).copy1DRangeFromUnchecked(0, mVtxCount / floatCount, mVtxData);
if(uploadToBufferObject) {
if (uploadToBufferObject) {
sm.getVertexAllocation(0).syncAll(Allocation.USAGE_SCRIPT);
}
}
- sm.getIndexSetAllocation(0).copyFrom(mIndexData);
+ sm.getIndexSetAllocation(0).copy1DRangeFromUnchecked(0, mIndexCount, mIndexData);
if (uploadToBufferObject) {
sm.getIndexSetAllocation(0).syncAll(Allocation.USAGE_SCRIPT);
}
diff --git a/graphics/java/android/renderscript/ProgramFragmentFixedFunction.java b/graphics/java/android/renderscript/ProgramFragmentFixedFunction.java
index 1af31f810253..666a3e66c3a2 100644
--- a/graphics/java/android/renderscript/ProgramFragmentFixedFunction.java
+++ b/graphics/java/android/renderscript/ProgramFragmentFixedFunction.java
@@ -280,9 +280,10 @@ public class ProgramFragmentFixedFunction extends ProgramFragment {
pf.mTextureCount = MAX_TEXTURE;
if (!mVaryingColorEnable) {
Allocation constantData = Allocation.createTyped(mRS,constType);
- float[] data = new float[4];
- data[0] = data[1] = data[2] = data[3] = 1.0f;
- constantData.copyFrom(data);
+ FieldPacker fp = new FieldPacker(16);
+ Float4 f4 = new Float4(1.f, 1.f, 1.f, 1.f);
+ fp.addF32(f4);
+ constantData.setFromFieldPacker(0, fp);
pf.bindConstants(constantData, 0);
}
return pf;
diff --git a/graphics/java/android/renderscript/ProgramVertexFixedFunction.java b/graphics/java/android/renderscript/ProgramVertexFixedFunction.java
index 666c7ec27f9c..556964a621fd 100644
--- a/graphics/java/android/renderscript/ProgramVertexFixedFunction.java
+++ b/graphics/java/android/renderscript/ProgramVertexFixedFunction.java
@@ -229,7 +229,7 @@ public class ProgramVertexFixedFunction extends ProgramVertex {
for(int i = 0; i < 16; i ++) {
mIOBuffer.addF32(m.mMat[i]);
}
- mAlloc.copyFrom(mIOBuffer.getData());
+ mAlloc.setFromFieldPacker(0, mIOBuffer);
}
/**
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index e3593daeee07..ade85e5b4852 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -268,6 +268,10 @@ void DisplayList::replay(OpenGLRenderer& renderer, uint32_t level) {
renderer.scale(getFloat(), getFloat());
}
break;
+ case Skew: {
+ renderer.skew(getFloat(), getFloat());
+ }
+ break;
case SetMatrix: {
renderer.setMatrix(getMatrix());
}
@@ -508,6 +512,12 @@ void DisplayListRenderer::scale(float sx, float sy) {
OpenGLRenderer::scale(sx, sy);
}
+void DisplayListRenderer::skew(float sx, float sy) {
+ addOp(DisplayList::Skew);
+ addPoint(sx, sy);
+ OpenGLRenderer::skew(sx, sy);
+}
+
void DisplayListRenderer::setMatrix(SkMatrix* matrix) {
addOp(DisplayList::SetMatrix);
addMatrix(matrix);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 71523349f0d3..05864ec8ad6f 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -98,6 +98,7 @@ public:
Translate,
Rotate,
Scale,
+ Skew,
SetMatrix,
ConcatMatrix,
ClipRect,
@@ -250,6 +251,7 @@ public:
void translate(float dx, float dy);
void rotate(float degrees);
void scale(float sx, float sy);
+ void skew(float sx, float sy);
void setMatrix(SkMatrix* matrix);
void concatMatrix(SkMatrix* matrix);
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index d1fbfbaa1639..c080501df338 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -38,8 +38,10 @@ namespace uirenderer {
// Font
///////////////////////////////////////////////////////////////////////////////
-Font::Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags) :
- mState(state), mFontId(fontId), mFontSize(fontSize), mFlags(flags) {
+Font::Font(FontRenderer* state, uint32_t fontId, float fontSize,
+ int flags, uint32_t italicStyle) :
+ mState(state), mFontId(fontId), mFontSize(fontSize),
+ mFlags(flags), mItalicStyle(italicStyle) {
}
@@ -275,17 +277,19 @@ Font::CachedGlyphInfo* Font::cacheGlyph(SkPaint* paint, int32_t glyph) {
return newGlyph;
}
-Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize, int flags) {
+Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize,
+ int flags, uint32_t italicStyle) {
Vector<Font*> &activeFonts = state->mActiveFonts;
for (uint32_t i = 0; i < activeFonts.size(); i++) {
Font* font = activeFonts[i];
- if (font->mFontId == fontId && font->mFontSize == fontSize && font->mFlags == flags) {
+ if (font->mFontId == fontId && font->mFontSize == fontSize &&
+ font->mFlags == flags && font->mItalicStyle == italicStyle) {
return font;
}
}
- Font* newFont = new Font(state, fontId, fontSize, flags);
+ Font* newFont = new Font(state, fontId, fontSize, flags, italicStyle);
activeFonts.push(newFont);
return newFont;
}
@@ -638,7 +642,10 @@ void FontRenderer::setFont(SkPaint* paint, uint32_t fontId, float fontSize) {
if (paint->isFakeBoldText()) {
flags |= Font::kFakeBold;
}
- mCurrentFont = Font::create(this, fontId, fontSize, flags);
+
+ const float skewX = paint->getTextSkewX();
+ uint32_t italicStyle = *(uint32_t*) &skewX;
+ mCurrentFont = Font::create(this, fontId, fontSize, flags, italicStyle);
const float maxPrecacheFontSize = 40.0f;
bool isNewFont = currentNumFonts != mActiveFonts.size();
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index 40572c6667b9..10058125a8e1 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -57,7 +57,8 @@ public:
/**
* Creates a new font associated with the specified font state.
*/
- static Font* create(FontRenderer* state, uint32_t fontId, float fontSize, int flags);
+ static Font* create(FontRenderer* state, uint32_t fontId, float fontSize,
+ int flags, uint32_t italicStyle);
protected:
friend class FontRenderer;
@@ -103,7 +104,7 @@ protected:
SkFixed mRsbDelta;
};
- Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags);
+ Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags, uint32_t italicStyle);
DefaultKeyedVector<int32_t, CachedGlyphInfo*> mCachedGlyphs;
@@ -122,6 +123,7 @@ protected:
uint32_t mFontId;
float mFontSize;
int mFlags;
+ uint32_t mItalicStyle;
};
class FontRenderer {
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index fe7f8834a8b2..e7c0fe35194a 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -178,6 +178,24 @@ void Matrix4::loadScale(float sx, float sy, float sz) {
data[kScaleZ] = sz;
}
+void Matrix4::loadSkew(float sx, float sy) {
+ loadIdentity();
+
+ data[kScaleX] = 1.0f;
+ data[kSkewX] = sx;
+ data[kTranslateX] = 0.0f;
+
+ data[kSkewY] = sy;
+ data[kScaleY] = 1.0f;
+ data[kTranslateY] = 0.0f;
+
+ data[kPerspective0] = 0.0f;
+ data[kPerspective1] = 0.0f;
+ data[kPerspective2] = 1.0f;
+
+ mSimpleMatrix = false;
+}
+
void Matrix4::loadRotate(float angle, float x, float y, float z) {
data[kPerspective0] = 0.0f;
data[kPerspective1] = 0.0f;
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 23fc6c375150..08f5d776d5f5 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -72,6 +72,7 @@ public:
void loadTranslate(float x, float y, float z);
void loadScale(float sx, float sy, float sz);
+ void loadSkew(float sx, float sy);
void loadRotate(float angle, float x, float y, float z);
void loadMultiply(const Matrix4& u, const Matrix4& v);
@@ -97,6 +98,12 @@ public:
multiply(u);
}
+ void skew(float sx, float sy) {
+ Matrix4 u;
+ u.loadSkew(sx, sy);
+ multiply(u);
+ }
+
void rotate(float angle, float x, float y, float z) {
Matrix4 u;
u.loadRotate(angle, x, y, z);
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 16a1de7adc32..2067acc1803c 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -766,6 +766,10 @@ void OpenGLRenderer::scale(float sx, float sy) {
mSnapshot->transform->scale(sx, sy, 1.0f);
}
+void OpenGLRenderer::skew(float sx, float sy) {
+ mSnapshot->transform->skew(sx, sy);
+}
+
void OpenGLRenderer::setMatrix(SkMatrix* matrix) {
mSnapshot->transform->load(*matrix);
}
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 7387b9268c39..272c5c249b04 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -84,6 +84,7 @@ public:
virtual void translate(float dx, float dy);
virtual void rotate(float degrees);
virtual void scale(float sx, float sy);
+ virtual void skew(float sx, float sy);
const float* getMatrix() const;
void getMatrix(SkMatrix* matrix);
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 1ab210950525..042f6c72eb7c 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -471,45 +471,42 @@ void ScriptCState::runCompiler(Context *rsc,
ScriptC *s,
const char *resName,
const char *cacheDir) {
- {
- s->mBccScript = bccCreateScript();
+ s->mBccScript = bccCreateScript();
- s->mEnviroment.mIsThreadable = true;
+ s->mEnviroment.mIsThreadable = true;
- bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s);
+ bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s);
- if (bccReadBC(s->mBccScript,
- resName,
- s->mEnviroment.mScriptText,
- s->mEnviroment.mScriptTextLength, 0) != 0) {
- LOGE("bcc: FAILS to read bitcode");
- // Handle Fatal Error
- }
+ if (bccReadBC(s->mBccScript,
+ resName,
+ s->mEnviroment.mScriptText,
+ s->mEnviroment.mScriptTextLength, 0) != 0) {
+ LOGE("bcc: FAILS to read bitcode");
+ // Handle Fatal Error
+ }
#if 1
- if (bccLinkBC(s->mBccScript,
- resName,
- NULL /*rs_runtime_lib_bc*/,
- 1 /*rs_runtime_lib_bc_size*/
- /*"1" means skip buffer here, and let libbcc decide*/,
- 0) != 0) {
- LOGE("bcc: FAILS to link bitcode");
- // Handle Fatal Error
- }
+ if (bccLinkBC(s->mBccScript,
+ resName,
+ NULL /*rs_runtime_lib_bc*/,
+ 1 /*rs_runtime_lib_bc_size*/
+ /*"1" means skip buffer here, and let libbcc decide*/,
+ 0) != 0) {
+ LOGE("bcc: FAILS to link bitcode");
+ // Handle Fatal Error
+ }
#endif
- char *cachePath = genCacheFileName(cacheDir, resName, ".oBCC");
+ char *cachePath = genCacheFileName(cacheDir, resName, ".oBCC");
- if (bccPrepareExecutable(s->mBccScript, cachePath, 0) != 0) {
- LOGE("bcc: FAILS to prepare executable");
- // Handle Fatal Error
- }
+ if (bccPrepareExecutable(s->mBccScript, cachePath, 0) != 0) {
+ LOGE("bcc: FAILS to prepare executable");
+ // Handle Fatal Error
+ }
- free(cachePath);
+ free(cachePath);
- s->mProgram.mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(s->mBccScript, "root"));
- s->mProgram.mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(s->mBccScript, "init"));
- }
- LOGV("%p ScriptCState::runCompiler root %p, init %p", rsc, s->mProgram.mRoot, s->mProgram.mInit);
+ s->mProgram.mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(s->mBccScript, "root"));
+ s->mProgram.mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(s->mBccScript, "init"));
if (s->mProgram.mInit) {
s->mProgram.mInit();
@@ -537,66 +534,62 @@ void ScriptCState::runCompiler(Context *rsc,
s->mEnviroment.mFragmentStore.set(rsc->getDefaultProgramStore());
s->mEnviroment.mRaster.set(rsc->getDefaultProgramRaster());
- if (s->mProgram.mRoot) {
- const static int pragmaMax = 16;
- size_t pragmaCount = bccGetPragmaCount(s->mBccScript);
- char const *keys[pragmaMax];
- char const *values[pragmaMax];
- bccGetPragmaList(s->mBccScript, pragmaMax, keys, values);
+ const static int pragmaMax = 16;
+ size_t pragmaCount = bccGetPragmaCount(s->mBccScript);
+ char const *keys[pragmaMax];
+ char const *values[pragmaMax];
+ bccGetPragmaList(s->mBccScript, pragmaMax, keys, values);
- for (size_t i=0; i < pragmaCount; ++i) {
- //LOGE("pragma %s %s", keys[i], values[i]);
- if (!strcmp(keys[i], "version")) {
+ for (size_t i=0; i < pragmaCount; ++i) {
+ //LOGE("pragma %s %s", keys[i], values[i]);
+ if (!strcmp(keys[i], "version")) {
+ // TODO: Verify that version is correct
+ continue;
+ }
+
+ if (!strcmp(keys[i], "stateVertex")) {
+ if (!strcmp(values[i], "default")) {
continue;
}
-
- if (!strcmp(keys[i], "stateVertex")) {
- if (!strcmp(values[i], "default")) {
- continue;
- }
- if (!strcmp(values[i], "parent")) {
- s->mEnviroment.mVertex.clear();
- continue;
- }
- LOGE("Unreconized value %s passed to stateVertex", values[i]);
+ if (!strcmp(values[i], "parent")) {
+ s->mEnviroment.mVertex.clear();
+ continue;
}
+ LOGE("Unreconized value %s passed to stateVertex", values[i]);
+ }
- if (!strcmp(keys[i], "stateRaster")) {
- if (!strcmp(values[i], "default")) {
- continue;
- }
- if (!strcmp(values[i], "parent")) {
- s->mEnviroment.mRaster.clear();
- continue;
- }
- LOGE("Unreconized value %s passed to stateRaster", values[i]);
+ if (!strcmp(keys[i], "stateRaster")) {
+ if (!strcmp(values[i], "default")) {
+ continue;
}
+ if (!strcmp(values[i], "parent")) {
+ s->mEnviroment.mRaster.clear();
+ continue;
+ }
+ LOGE("Unreconized value %s passed to stateRaster", values[i]);
+ }
- if (!strcmp(keys[i], "stateFragment")) {
- if (!strcmp(values[i], "default")) {
- continue;
- }
- if (!strcmp(values[i], "parent")) {
- s->mEnviroment.mFragment.clear();
- continue;
- }
- LOGE("Unreconized value %s passed to stateFragment", values[i]);
+ if (!strcmp(keys[i], "stateFragment")) {
+ if (!strcmp(values[i], "default")) {
+ continue;
+ }
+ if (!strcmp(values[i], "parent")) {
+ s->mEnviroment.mFragment.clear();
+ continue;
}
+ LOGE("Unreconized value %s passed to stateFragment", values[i]);
+ }
- if (!strcmp(keys[i], "stateStore")) {
- if (!strcmp(values[i], "default")) {
- continue;
- }
- if (!strcmp(values[i], "parent")) {
- s->mEnviroment.mFragmentStore.clear();
- continue;
- }
- LOGE("Unreconized value %s passed to stateStore", values[i]);
+ if (!strcmp(keys[i], "stateStore")) {
+ if (!strcmp(values[i], "default")) {
+ continue;
}
+ if (!strcmp(values[i], "parent")) {
+ s->mEnviroment.mFragmentStore.clear();
+ continue;
+ }
+ LOGE("Unreconized value %s passed to stateStore", values[i]);
}
- } else {
- LOGE("bcc: FAILS to prepare executable");
- // Handle Fatal Error
}
}
diff --git a/libs/rs/scriptc/rs_cl.rsh b/libs/rs/scriptc/rs_cl.rsh
index a5092b36fff0..b9bb1f729f42 100644
--- a/libs/rs/scriptc/rs_cl.rsh
+++ b/libs/rs/scriptc/rs_cl.rsh
@@ -449,57 +449,87 @@ extern float __attribute__((overloadable)) trunc(float);
DEF_FUNC_1(trunc)
// Int ops (partial), 6.11.3
-extern uint __attribute__((overloadable)) abs(int);
-extern ushort __attribute__((overloadable)) abs(short);
-extern uchar __attribute__((overloadable)) abs(char);
-
-extern uint __attribute__((overloadable)) clz(uint);
-extern int __attribute__((overloadable)) clz(int);
-extern ushort __attribute__((overloadable)) clz(ushort);
-extern short __attribute__((overloadable)) clz(short);
-extern uchar __attribute__((overloadable)) clz(uchar);
-extern char __attribute__((overloadable)) clz(char);
-
-static uint __attribute__((overloadable)) min(uint v1, uint v2) {
- return v1 < v2 ? v1 : v2;
-}
-static int __attribute__((overloadable)) min(int v1, int v2) {
- return v1 < v2 ? v1 : v2;
-}
-static ushort __attribute__((overloadable)) min(ushort v1, ushort v2) {
- return v1 < v2 ? v1 : v2;
-}
-static short __attribute__((overloadable)) min(short v1, short v2) {
- return v1 < v2 ? v1 : v2;
-}
-static uchar __attribute__((overloadable)) min(uchar v1, uchar v2) {
- return v1 < v2 ? v1 : v2;
-}
-static char __attribute__((overloadable)) min(char v1, char v2) {
- return v1 < v2 ? v1 : v2;
-}
-
-static uint __attribute__((overloadable)) max(uint v1, uint v2) {
- return v1 > v2 ? v1 : v2;
-}
-static int __attribute__((overloadable)) max(int v1, int v2) {
- return v1 > v2 ? v1 : v2;
-}
-static ushort __attribute__((overloadable)) max(ushort v1, ushort v2) {
- return v1 > v2 ? v1 : v2;
-}
-static short __attribute__((overloadable)) max(short v1, short v2) {
- return v1 > v2 ? v1 : v2;
-}
-static uchar __attribute__((overloadable)) max(uchar v1, uchar v2) {
- return v1 > v2 ? v1 : v2;
-}
-static char __attribute__((overloadable)) max(char v1, char v2) {
- return v1 > v2 ? v1 : v2;
-}
-
-
+#define DEF_RIFUNC_1(typeout, typein, fnc) \
+extern typeout __attribute__((overloadable)) fnc(typein); \
+static typeout##2 __attribute__((overloadable)) fnc(typein##2 v) { \
+ typeout##2 r; \
+ r.x = fnc(v.x); \
+ r.y = fnc(v.y); \
+ return r; \
+} \
+static typeout##3 __attribute__((overloadable)) fnc(typein##3 v) { \
+ typeout##3 r; \
+ r.x = fnc(v.x); \
+ r.y = fnc(v.y); \
+ r.z = fnc(v.z); \
+ return r; \
+} \
+static typeout##4 __attribute__((overloadable)) fnc(typein##4 v) { \
+ typeout##4 r; \
+ r.x = fnc(v.x); \
+ r.y = fnc(v.y); \
+ r.z = fnc(v.z); \
+ r.w = fnc(v.w); \
+ return r; \
+}
+
+#define DEF_UIFUNC_1(fnc) \
+DEF_RIFUNC_1(uchar, char, fnc) \
+DEF_RIFUNC_1(ushort, short, fnc) \
+DEF_RIFUNC_1(uint, int, fnc)
+
+#define DEF_IFUNC_1(fnc) \
+DEF_RIFUNC_1(uchar, uchar, fnc) \
+DEF_RIFUNC_1(char, char, fnc) \
+DEF_RIFUNC_1(ushort, ushort, fnc) \
+DEF_RIFUNC_1(short, short, fnc) \
+DEF_RIFUNC_1(uint, uint, fnc) \
+DEF_RIFUNC_1(int, int, fnc)
+
+#define DEF_RIFUNC_2(type, fnc, body) \
+static type __attribute__((overloadable)) fnc(type v1, type v2) { \
+ return body; \
+} \
+static type##2 __attribute__((overloadable)) fnc(type##2 v1, type##2 v2) { \
+ type##2 r; \
+ r.x = fnc(v1.x, v2.x); \
+ r.y = fnc(v1.y, v2.y); \
+ return r; \
+} \
+static type##3 __attribute__((overloadable)) fnc(type##3 v1, type##3 v2) { \
+ type##3 r; \
+ r.x = fnc(v1.x, v2.x); \
+ r.y = fnc(v1.y, v2.y); \
+ r.z = fnc(v1.z, v2.z); \
+ return r; \
+} \
+static type##4 __attribute__((overloadable)) fnc(type##4 v1, type##4 v2) { \
+ type##4 r; \
+ r.x = fnc(v1.x, v2.x); \
+ r.y = fnc(v1.y, v2.y); \
+ r.z = fnc(v1.z, v2.z); \
+ r.w = fnc(v1.w, v2.w); \
+ return r; \
+} \
+
+#define DEF_IFUNC_2(fnc, body) \
+DEF_RIFUNC_2(uchar, fnc, body) \
+DEF_RIFUNC_2(char, fnc, body) \
+DEF_RIFUNC_2(ushort, fnc, body) \
+DEF_RIFUNC_2(short, fnc, body) \
+DEF_RIFUNC_2(uint, fnc, body) \
+DEF_RIFUNC_2(int, fnc, body) \
+DEF_RIFUNC_2(float, fnc, body)
+
+DEF_UIFUNC_1(abs)
+DEF_IFUNC_1(clz)
+
+DEF_IFUNC_2(min, (v1 < v2 ? v1 : v2))
+DEF_FUNC_2F(min)
+
+DEF_IFUNC_2(max, (v1 > v2 ? v1 : v2))
+DEF_FUNC_2F(max)
// 6.11.4
@@ -554,98 +584,6 @@ static float __attribute__((overloadable)) degrees(float radians) {
}
DEF_FUNC_1(degrees)
-static float __attribute__((overloadable)) max(float v1, float v2) {
- return v1 > v2 ? v1 : v2;
-}
-static float2 __attribute__((overloadable)) max(float2 v1, float2 v2) {
- float2 r;
- r.x = v1.x > v2.x ? v1.x : v2.x;
- r.y = v1.y > v2.y ? v1.y : v2.y;
- return r;
-}
-static float3 __attribute__((overloadable)) max(float3 v1, float3 v2) {
- float3 r;
- r.x = v1.x > v2.x ? v1.x : v2.x;
- r.y = v1.y > v2.y ? v1.y : v2.y;
- r.z = v1.z > v2.z ? v1.z : v2.z;
- return r;
-}
-static float4 __attribute__((overloadable)) max(float4 v1, float4 v2) {
- float4 r;
- r.x = v1.x > v2.x ? v1.x : v2.x;
- r.y = v1.y > v2.y ? v1.y : v2.y;
- r.z = v1.z > v2.z ? v1.z : v2.z;
- r.w = v1.w > v2.w ? v1.w : v2.w;
- return r;
-}
-static float2 __attribute__((overloadable)) max(float2 v1, float v2) {
- float2 r;
- r.x = v1.x > v2 ? v1.x : v2;
- r.y = v1.y > v2 ? v1.y : v2;
- return r;
-}
-static float3 __attribute__((overloadable)) max(float3 v1, float v2) {
- float3 r;
- r.x = v1.x > v2 ? v1.x : v2;
- r.y = v1.y > v2 ? v1.y : v2;
- r.z = v1.z > v2 ? v1.z : v2;
- return r;
-}
-static float4 __attribute__((overloadable)) max(float4 v1, float v2) {
- float4 r;
- r.x = v1.x > v2 ? v1.x : v2;
- r.y = v1.y > v2 ? v1.y : v2;
- r.z = v1.z > v2 ? v1.z : v2;
- r.w = v1.w > v2 ? v1.w : v2;
- return r;
-}
-
-static float __attribute__((overloadable)) min(float v1, float v2) {
- return v1 < v2 ? v1 : v2;
-}
-static float2 __attribute__((overloadable)) min(float2 v1, float2 v2) {
- float2 r;
- r.x = v1.x < v2.x ? v1.x : v2.x;
- r.y = v1.y < v2.y ? v1.y : v2.y;
- return r;
-}
-static float3 __attribute__((overloadable)) min(float3 v1, float3 v2) {
- float3 r;
- r.x = v1.x < v2.x ? v1.x : v2.x;
- r.y = v1.y < v2.y ? v1.y : v2.y;
- r.z = v1.z < v2.z ? v1.z : v2.z;
- return r;
-}
-static float4 __attribute__((overloadable)) min(float4 v1, float4 v2) {
- float4 r;
- r.x = v1.x < v2.x ? v1.x : v2.x;
- r.y = v1.y < v2.y ? v1.y : v2.y;
- r.z = v1.z < v2.z ? v1.z : v2.z;
- r.w = v1.w < v2.w ? v1.w : v2.w;
- return r;
-}
-static float2 __attribute__((overloadable)) min(float2 v1, float v2) {
- float2 r;
- r.x = v1.x < v2 ? v1.x : v2;
- r.y = v1.y < v2 ? v1.y : v2;
- return r;
-}
-static float3 __attribute__((overloadable)) min(float3 v1, float v2) {
- float3 r;
- r.x = v1.x < v2 ? v1.x : v2;
- r.y = v1.y < v2 ? v1.y : v2;
- r.z = v1.z < v2 ? v1.z : v2;
- return r;
-}
-static float4 __attribute__((overloadable)) min(float4 v1, float v2) {
- float4 r;
- r.x = v1.x < v2 ? v1.x : v2;
- r.y = v1.y < v2 ? v1.y : v2;
- r.z = v1.z < v2 ? v1.z : v2;
- r.w = v1.w < v2 ? v1.w : v2;
- return r;
-}
-
static float __attribute__((overloadable)) mix(float start, float stop, float amount) {
return start + (stop - start) * amount;
}
@@ -810,5 +748,10 @@ static float4 __attribute__((overloadable)) normalize(float4 v) {
#undef DEF_FUNC_1_RI
#undef DEF_FUNC_2
#undef DEF_FUNC_2F
+#undef DEF_RIFUNC_1
+#undef DEF_UIFUNC_1
+#undef DEF_IFUNC_1
+#undef DEF_RIFUNC_2
+#undef DEF_IFUNC_2
#endif
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 892939387210..10c9a9a99f5a 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1177,7 +1177,8 @@ public class MediaScanner
long lastModifiedSeconds = file.lastModified() / 1000;
// always scan the file, so we can return the content://media Uri for existing files
- return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),false, true);
+ return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),
+ false, true);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
return null;
@@ -1185,17 +1186,30 @@ public class MediaScanner
}
public void scanMtpFile(String path, String volumeName, int objectHandle, int format) {
+ initialize(volumeName);
MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path);
int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType);
+ File file = new File(path);
+ long lastModifiedSeconds = file.lastModified() / 1000;
if (!MediaFile.isAudioFileType(fileType) && !MediaFile.isVideoFileType(fileType) &&
!MediaFile.isImageFileType(fileType) && !MediaFile.isPlayListFileType(fileType)) {
- // nothing to do
+
+ // no need to use the media scanner, but we need to update last modified and file size
+ ContentValues values = new ContentValues();
+ values.put(Files.FileColumns.SIZE, file.length());
+ values.put(Files.FileColumns.DATE_MODIFIED, lastModifiedSeconds);
+ try {
+ String[] whereArgs = new String[] { Integer.toString(objectHandle) };
+ mMediaProvider.update(Files.getMtpObjectsUri(volumeName), values, "_id=?",
+ whereArgs);
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException in scanMtpFile", e);
+ }
return;
}
mMtpObjectHandle = objectHandle;
- initialize(volumeName);
try {
if (MediaFile.isPlayListFileType(fileType)) {
// build file cache so we can look up tracks in the playlist
@@ -1213,11 +1227,6 @@ public class MediaScanner
// MTP will create a file entry for us so we don't want to do it in prescan
prescan(path, false);
- File file = new File(path);
-
- // lastModified is in milliseconds on Files.
- long lastModifiedSeconds = file.lastModified() / 1000;
-
// always scan the file, so we can return the content://media Uri for existing files
mClient.doScanFile(path, mediaFileType.mimeType, lastModifiedSeconds, file.length(),
(format == MtpConstants.FORMAT_ASSOCIATION), true);
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index ac476ffe5eb3..a7c7fce211c2 100644
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -185,7 +185,7 @@ public class MtpDatabase {
}
}
- private void endSendObject(String path, int handle, int format, long actualSize, boolean succeeded) {
+ private void endSendObject(String path, int handle, int format, boolean succeeded) {
if (succeeded) {
// handle abstract playlists separately
// they do not exist in the file system so don't use the media scanner here
@@ -196,6 +196,10 @@ public class MtpDatabase {
if (lastSlash >= 0) {
name = name.substring(lastSlash + 1);
}
+ // strip trailing ".pla" from the name
+ if (name.endsWith(".pla")) {
+ name = name.substring(0, name.length() - 4);
+ }
ContentValues values = new ContentValues(1);
values.put(Audio.Playlists.DATA, path);
@@ -208,18 +212,6 @@ public class MtpDatabase {
Log.e(TAG, "RemoteException in endSendObject", e);
}
} else {
- if (actualSize >= 0) {
- // update size if necessary
- ContentValues values = new ContentValues();
- values.put(Files.FileColumns.SIZE, actualSize);
- try {
- String[] whereArgs = new String[] { Integer.toString(handle) };
- mMediaProvider.update(mObjectsUri, values, ID_WHERE, whereArgs);
- } catch (RemoteException e) {
- Log.e(TAG, "RemoteException in mMediaProvider.update", e);
- }
- }
-
mMediaScanner.scanMtpFile(path, mVolumeName, handle, format);
}
} else {
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 8f9b8a2b0c6e..9abf6a241dd7 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -99,7 +99,6 @@ public:
virtual void endSendObject(const char* path,
MtpObjectHandle handle,
MtpObjectFormat format,
- int64_t actualSize,
bool succeeded);
virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
@@ -236,11 +235,11 @@ MtpObjectHandle MyMtpDatabase::beginSendObject(const char* path,
}
void MyMtpDatabase::endSendObject(const char* path, MtpObjectHandle handle,
- MtpObjectFormat format, int64_t actualSize, bool succeeded) {
+ MtpObjectFormat format, bool succeeded) {
JNIEnv* env = AndroidRuntime::getJNIEnv();
jstring pathStr = env->NewStringUTF(path);
env->CallVoidMethod(mDatabase, method_endSendObject, pathStr,
- (jint)handle, (jint)format, (jlong)actualSize, (jboolean)succeeded);
+ (jint)handle, (jint)format, (jboolean)succeeded);
if (pathStr)
env->DeleteLocalRef(pathStr);
@@ -1094,7 +1093,7 @@ int register_android_mtp_MtpDatabase(JNIEnv *env)
LOGE("Can't find beginSendObject");
return -1;
}
- method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIJZ)V");
+ method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIZ)V");
if (method_endSendObject == NULL) {
LOGE("Can't find endSendObject");
return -1;
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 4cfe28ec37c9..49d05eda2348 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -520,8 +520,10 @@ bool AwesomePlayer::getCachedDuration_l(int64_t *durationUs, bool *eos) {
*durationUs = mRTSPController->getQueueDurationUs(eos);
return true;
} else if (mCachedSource != NULL && getBitrate(&bitrate)) {
- size_t cachedDataRemaining = mCachedSource->approxDataRemaining(eos);
+ status_t finalStatus;
+ size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
*durationUs = cachedDataRemaining * 8000000ll / bitrate;
+ *eos = (finalStatus != OK);
return true;
}
@@ -564,11 +566,14 @@ void AwesomePlayer::onBufferingUpdate() {
mBufferingEventPending = false;
if (mCachedSource != NULL) {
- bool eos;
- size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&eos);
+ status_t finalStatus;
+ size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
+ bool eos = (finalStatus != OK);
if (eos) {
- notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
+ if (finalStatus == ERROR_END_OF_STREAM) {
+ notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
+ }
if (mFlags & PREPARING) {
LOGV("cache has reached EOS, prepare is done.");
finishAsyncPrepare_l();
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 9017921df2c0..20f16555517a 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -393,13 +393,13 @@ size_t NuCachedSource2::cachedSize() {
return mCacheOffset + mCache->totalSize();
}
-size_t NuCachedSource2::approxDataRemaining(bool *eos) {
+size_t NuCachedSource2::approxDataRemaining(status_t *finalStatus) {
Mutex::Autolock autoLock(mLock);
- return approxDataRemaining_l(eos);
+ return approxDataRemaining_l(finalStatus);
}
-size_t NuCachedSource2::approxDataRemaining_l(bool *eos) {
- *eos = (mFinalStatus != OK);
+size_t NuCachedSource2::approxDataRemaining_l(status_t *finalStatus) {
+ *finalStatus = mFinalStatus;
off64_t lastBytePosCached = mCacheOffset + mCache->totalSize();
if (mLastAccessPos < lastBytePosCached) {
return lastBytePosCached - mLastAccessPos;
@@ -488,4 +488,3 @@ String8 NuCachedSource2::getUri() {
return mSource->getUri();
}
} // namespace android
-
diff --git a/media/libstagefright/include/NuCachedSource2.h b/media/libstagefright/include/NuCachedSource2.h
index aa320fc2bdcc..28840be37191 100644
--- a/media/libstagefright/include/NuCachedSource2.h
+++ b/media/libstagefright/include/NuCachedSource2.h
@@ -43,7 +43,7 @@ struct NuCachedSource2 : public DataSource {
////////////////////////////////////////////////////////////////////////////
size_t cachedSize();
- size_t approxDataRemaining(bool *eos);
+ size_t approxDataRemaining(status_t *finalStatus);
void resumeFetchingIfNecessary();
@@ -92,7 +92,7 @@ private:
ssize_t readInternal(off64_t offset, void *data, size_t size);
status_t seekInternal_l(off64_t offset);
- size_t approxDataRemaining_l(bool *eos);
+ size_t approxDataRemaining_l(status_t *finalStatus);
void restartPrefetcherIfNecessary_l(bool ignoreLowWaterThreshold = false);
DISALLOW_EVIL_CONSTRUCTORS(NuCachedSource2);
diff --git a/media/libstagefright/rtsp/APacketSource.cpp b/media/libstagefright/rtsp/APacketSource.cpp
index 10cc88bd7d15..f0b858da1d25 100644
--- a/media/libstagefright/rtsp/APacketSource.cpp
+++ b/media/libstagefright/rtsp/APacketSource.cpp
@@ -373,7 +373,17 @@ static bool ExtractDimensionsFromVOLHeader(
br.skipBits(2); // chroma_format
br.skipBits(1); // low_delay
if (br.getBits(1)) { // vbv_parameters
- TRESPASS();
+ br.skipBits(15); // first_half_bit_rate
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(15); // latter_half_bit_rate
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(15); // first_half_vbv_buffer_size
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(3); // latter_half_vbv_buffer_size
+ br.skipBits(11); // first_half_vbv_occupancy
+ CHECK(br.getBits(1)); // marker_bit
+ br.skipBits(15); // latter_half_vbv_occupancy
+ CHECK(br.getBits(1)); // marker_bit
}
}
unsigned video_object_layer_shape = br.getBits(2);
diff --git a/media/mtp/MtpDatabase.h b/media/mtp/MtpDatabase.h
index 6dcb931ad1cf..4d9a1ae3d6a4 100644
--- a/media/mtp/MtpDatabase.h
+++ b/media/mtp/MtpDatabase.h
@@ -42,7 +42,6 @@ public:
virtual void endSendObject(const char* path,
MtpObjectHandle handle,
MtpObjectFormat format,
- int64_t size,
bool succeeded) = 0;
virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID,
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 236cd0a4502e..b1bd145f6d8e 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -700,6 +700,9 @@ MtpResponseCode MtpServer::doSendObjectInfo() {
if (ret && ret != -EEXIST)
return MTP_RESPONSE_GENERAL_ERROR;
chown((const char *)path, getuid(), mFileGroup);
+
+ // SendObject does not get sent for directories, so call endSendObject here instead
+ mDatabase->endSendObject(path, handle, MTP_FORMAT_ASSOCIATION, MTP_RESPONSE_OK);
} else {
mSendObjectFilePath = path;
// save the handle for the SendObject call, which should follow
@@ -718,7 +721,6 @@ MtpResponseCode MtpServer::doSendObject() {
MtpResponseCode result = MTP_RESPONSE_OK;
mode_t mask;
int ret;
- uint64_t actualSize = -1;
if (mSendObjectHandle == kInvalidObjectHandle) {
LOGE("Expected SendObjectInfo before SendObject");
@@ -761,18 +763,11 @@ MtpResponseCode MtpServer::doSendObject() {
result = MTP_RESPONSE_TRANSACTION_CANCELLED;
else
result = MTP_RESPONSE_GENERAL_ERROR;
- } else if (mSendObjectFileSize == 0xFFFFFFFF) {
- // actual size is likely > 4 gig so stat the file to compute actual length
- struct stat s;
- if (lstat(mSendObjectFilePath, &s) == 0) {
- actualSize = s.st_size;
- LOGD("actualSize: %lld\n", actualSize);
- }
}
done:
mDatabase->endSendObject(mSendObjectFilePath, mSendObjectHandle, mSendObjectFormat,
- actualSize, result == MTP_RESPONSE_OK);
+ result == MTP_RESPONSE_OK);
mSendObjectHandle = kInvalidObjectHandle;
mSendObjectFormat = 0;
return result;
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 8f2f974ba2d5..4099c4c59e8b 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -272,6 +272,37 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
}
/**
+ * @hide
+ * Control whether the EGL context is preserved when the GLSurfaceView is paused and
+ * resumed.
+ * <p>
+ * If set to true, then the EGL context may be preserved when the GLSurfaceView is paused.
+ * Whether the EGL context is actually preserved or not depends upon whether the
+ * Android device that the program is running on can support an arbitrary number of EGL
+ * contexts or not. Devices that can only support a limited number of EGL contexts must
+ * release the EGL context in order to allow multiple applications to share the GPU.
+ * <p>
+ * If set to false, the EGL context will be released when the GLSurfaceView is paused,
+ * and recreated when the GLSurfaceView is resumed.
+ * <p>
+ *
+ * The default is false.
+ *
+ * @param preserveOnPause preserve the EGL context when paused
+ */
+ public void setPreserveEGLContextOnPause(boolean preserveOnPause) {
+ mPreserveEGLContextOnPause = preserveOnPause;
+ }
+
+ /**
+ * @hide
+ * @return true if the EGL context will be preserved when paused
+ */
+ public boolean getPreserveEGLContextOnPause() {
+ return mPreserveEGLContextOnPause;
+ }
+
+ /**
* Set the renderer associated with this view. Also starts the thread that
* will call the renderer, which in turn causes the rendering to start.
* <p>This method should be called once and only once in the life-cycle of
@@ -1240,7 +1271,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
Log.i("GLThread", "releasing EGL surface because paused tid=" + getId());
}
stopEglSurfaceLocked();
- if (sGLThreadManager.shouldReleaseEGLContextWhenPausing()) {
+ if (!mPreserveEGLContextOnPause || sGLThreadManager.shouldReleaseEGLContextWhenPausing()) {
stopEglContextLocked();
if (LOG_SURFACE) {
Log.i("GLThread", "releasing EGL context because paused tid=" + getId());
@@ -1705,7 +1736,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
// Release the EGL context when pausing even if
// the hardware supports multiple EGL contexts.
// Otherwise the device could run out of EGL contexts.
- return true;
+ return mLimitedGLESContexts;
}
public synchronized boolean shouldTerminateEGLWhenPausing() {
@@ -1716,16 +1747,18 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
public synchronized void checkGLDriver(GL10 gl) {
if (! mGLESDriverCheckComplete) {
checkGLESVersion();
+ String renderer = gl.glGetString(GL10.GL_RENDERER);
if (mGLESVersion < kGLES_20) {
- String renderer = gl.glGetString(GL10.GL_RENDERER);
mMultipleGLESContextsAllowed =
! renderer.startsWith(kMSM7K_RENDERER_PREFIX);
- if (LOG_SURFACE) {
- Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
- + mMultipleGLESContextsAllowed);
- }
notifyAll();
}
+ mLimitedGLESContexts = !mMultipleGLESContextsAllowed || renderer.startsWith(kADRENO);
+ if (LOG_SURFACE) {
+ Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
+ + mMultipleGLESContextsAllowed
+ + " mLimitedGLESContexts = " + mLimitedGLESContexts);
+ }
mGLESDriverCheckComplete = true;
}
}
@@ -1750,9 +1783,11 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
private int mGLESVersion;
private boolean mGLESDriverCheckComplete;
private boolean mMultipleGLESContextsAllowed;
+ private boolean mLimitedGLESContexts;
private static final int kGLES_20 = 0x20000;
private static final String kMSM7K_RENDERER_PREFIX =
"Q3Dimension MSM7500 ";
+ private static final String kADRENO = "Adreno";
private GLThread mEglOwner;
}
@@ -1768,4 +1803,5 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
private GLWrapper mGLWrapper;
private int mDebugFlags;
private int mEGLContextClientVersion;
+ private boolean mPreserveEGLContextOnPause;
}
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png
index 993ea5591c8b..335960243cfe 100644
--- a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png
+++ b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_ime_pressed.png
Binary files differ
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
index 69bc161fea7c..7012ddcbce8d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java
@@ -188,6 +188,12 @@ public class InputMethodButton extends ImageView {
Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY, ID_IME_BUTTON_VISIBILITY_AUTO);
}
+ public void setIconImage(int resId) {
+ if (mIcon != null) {
+ mIcon.setImageResource(resId);
+ }
+ }
+
public void setIMEButtonVisible(IBinder token, boolean keyboardVisible) {
mToken = token;
mKeyboardVisible = keyboardVisible;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
index add67b156785..cc200e39d028 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java
@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.tablet;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
import android.provider.Settings;
@@ -53,11 +52,12 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O
new HashMap<InputMethodInfo, List<InputMethodSubtype>>();
private final HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>> mRadioViewAndImiMap =
new HashMap<View, Pair<InputMethodInfo, InputMethodSubtype>>();
- private final PackageManager mPackageManager;
private Context mContext;
private IBinder mToken;
+ private InputMethodButton mInputMethodSwitchButton;
private LinearLayout mInputMethodMenuList;
+ private PackageManager mPackageManager;
private String mEnabledInputMethodAndSubtypesCacheStr;
private View mConfigureImeShortcut;
@@ -69,7 +69,6 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O
super(context, attrs, defStyle);
mContext = context;
mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
- mPackageManager = context.getPackageManager();
}
@Override
@@ -90,8 +89,17 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O
@Override
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
- if (visibility == View.VISIBLE && changedView == this) {
- updateUiElements();
+ if (changedView == this) {
+ if (visibility == View.VISIBLE) {
+ updateUiElements();
+ if (mInputMethodSwitchButton != null) {
+ mInputMethodSwitchButton.setIconImage(R.drawable.ic_sysbar_ime_pressed);
+ }
+ } else {
+ if (mInputMethodSwitchButton != null) {
+ mInputMethodSwitchButton.setIconImage(R.drawable.ic_sysbar_ime);
+ }
+ }
}
}
@@ -180,6 +188,8 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O
// TODO: Reuse subtype views.
mInputMethodMenuList.removeAllViews();
mRadioViewAndImiMap.clear();
+ mPackageManager = mContext.getPackageManager();
+
HashMap<InputMethodInfo, List<InputMethodSubtype>> enabledIMIs
= getEnabledInputMethodAndSubtypeList();
// TODO: Sort by alphabet and mode.
@@ -198,10 +208,14 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O
updateRadioButtons();
}
- public void setIMEToken(IBinder token) {
+ public void setImeToken(IBinder token) {
mToken = token;
}
+ public void setImeSwitchButton(InputMethodButton imb) {
+ mInputMethodSwitchButton = imb;
+ }
+
private void setInputMethodAndSubtype(InputMethodInfo imi, InputMethodSubtype subtype) {
if (mToken != null) {
mImm.setInputMethodAndSubtype(mToken, imi.getId(), subtype);
@@ -308,6 +322,10 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O
private CharSequence getSubtypeName(InputMethodInfo imi, InputMethodSubtype subtype) {
if (imi == null || subtype == null) return null;
+ if (DEBUG) {
+ Log.d(TAG, "Get text from: " + imi.getPackageName() + subtype.getNameResId()
+ + imi.getServiceInfo().applicationInfo);
+ }
// TODO: Change the language of subtype name according to subtype's locale.
return mPackageManager.getText(
imi.getPackageName(), subtype.getNameResId(), imi.getServiceInfo().applicationInfo);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
index bab8ed359ac4..7544f4621ebd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
@@ -297,7 +297,7 @@ public class RecentAppsPanel extends RelativeLayout implements StatusBarPanel, O
private Drawable getFullResDefaultActivityIcon() {
return getFullResIcon(Resources.getSystem(),
- com.android.internal.R.drawable.sym_def_app_icon);
+ com.android.internal.R.mipmap.sym_def_app_icon);
}
private Drawable getFullResIcon(Resources resources, int iconId) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
index e864577b97c6..a67f9157459f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/ShirtPocket.java
@@ -120,7 +120,7 @@ public class ShirtPocket extends ImageView {
mAltText.setVisibility(View.VISIBLE);
if (mClipping.getItemCount() > 0) {
// TODO: figure out how to visualize every kind of ClipData!
- mAltText.setText(mClipping.getItem(0).coerceToText(getContext()));
+ mAltText.setText(mClipping.getItemAt(0).coerceToText(getContext()));
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 825877a7451f..6db74d133372 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -272,6 +272,7 @@ public class TabletStatusBar extends StatusBar implements
mInputMethodsPanel.setVisibility(View.GONE);
mInputMethodsPanel.setOnTouchListener(new TouchOutsideListener(
MSG_CLOSE_INPUT_METHODS_PANEL, mInputMethodsPanel));
+ mInputMethodsPanel.setImeSwitchButton(mInputMethodSwitchButton);
mStatusBarView.setIgnoreChildren(3, mInputMethodSwitchButton, mInputMethodsPanel);
lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
@@ -853,7 +854,7 @@ public class TabletStatusBar extends StatusBar implements
if (oldVisibility != mInputMethodSwitchButton.getVisibility()) {
updateNotificationIcons();
}
- mInputMethodsPanel.setIMEToken(token);
+ mInputMethodsPanel.setImeToken(token);
mBackButton.setImageResource(
visible ? R.drawable.ic_sysbar_back_ime : R.drawable.ic_sysbar_back);
if (FAKE_SPACE_BAR) {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
index 70a4b20bb61a..32c016d8407e 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java
@@ -114,14 +114,12 @@ public class KeyguardViewManager implements KeyguardWindowController {
lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
lp.windowAnimations = com.android.internal.R.style.Animation_LockScreen;
- if (mContext.getResources().getBoolean(R.bool.config_enableLockScreenRotation)) {
- Log.d(TAG, "Rotation sensor for lock screen On!");
- lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
- } else {
- Log.d(TAG, "Rotation sensor for lock screen Off!");
- lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
- }
-
+ // TODO: Sometimes we get the wrong value for the sensor resource we use to configure
+ // this. However, the current UI design has LockScreen always respond to orientation so
+ // we don't need this for the time-being.
+ //
+ // For reference, the configuration variable is R.bool.config_enableLockScreenRotation
+ lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
lp.setTitle("Keyguard");
mWindowLayoutParams = lp;
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index c0c3afde1eaa..780996171a7e 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -123,7 +123,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
/**
* The default amount of time we stay awake (used for all key input)
*/
- protected static final int AWAKE_INTERVAL_DEFAULT_MS = 5000;
+ protected static final int AWAKE_INTERVAL_DEFAULT_MS = 10000;
/**
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 6b559cf6dce5..747242f468cf 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1965,23 +1965,29 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// behind it.
return false;
}
- if (mStatusBar != null && mStatusBar.isVisibleLw()) {
- Rect rect = new Rect(mStatusBar.getShownFrameLw());
- for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
- WindowState w = mStatusBarPanels.get(i);
- if (w.isVisibleLw()) {
- rect.union(w.getShownFrameLw());
+ if (false) {
+ // Don't do this on the tablet, since the system bar never completely
+ // covers the screen, and with all its transparency this will
+ // incorrectly think it does cover it when it doesn't. We'll revisit
+ // this later when we re-do the phone status bar.
+ if (mStatusBar != null && mStatusBar.isVisibleLw()) {
+ Rect rect = new Rect(mStatusBar.getShownFrameLw());
+ for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
+ WindowState w = mStatusBarPanels.get(i);
+ if (w.isVisibleLw()) {
+ rect.union(w.getShownFrameLw());
+ }
+ }
+ final int insetw = mRestrictedScreenWidth/10;
+ final int inseth = mRestrictedScreenHeight/10;
+ if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
+ mRestrictedScreenHeight-inseth)) {
+ // All of the status bar windows put together cover the
+ // screen, so the app can't be seen. (Note this test doesn't
+ // work if the rects of these windows are at off offsets or
+ // sizes, causing gaps in the rect union we have computed.)
+ return false;
}
- }
- final int insetw = mRestrictedScreenWidth/10;
- final int inseth = mRestrictedScreenHeight/10;
- if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
- mRestrictedScreenHeight-inseth)) {
- // All of the status bar windows put together cover the
- // screen, so the app can't be seen. (Note this test doesn't
- // work if the rects of these windows are at off offsets or
- // sizes, causing gaps in the rect union we have computed.)
- return false;
}
}
return true;
diff --git a/services/input/PointerController.cpp b/services/input/PointerController.cpp
index ebc58eeb03c2..92af51e6c82c 100644
--- a/services/input/PointerController.cpp
+++ b/services/input/PointerController.cpp
@@ -310,8 +310,16 @@ void PointerController::setDisplayOrientation(int32_t orientation) {
void PointerController::setPointerIcon(const SkBitmap* bitmap, float hotSpotX, float hotSpotY) {
AutoMutex _l(mLock);
- delete mLocked.iconBitmap;
- mLocked.iconBitmap = bitmap ? new SkBitmap(*bitmap) : NULL;
+ if (mLocked.iconBitmap) {
+ delete mLocked.iconBitmap;
+ mLocked.iconBitmap = NULL;
+ }
+
+ if (bitmap) {
+ mLocked.iconBitmap = new SkBitmap();
+ bitmap->copyTo(mLocked.iconBitmap, SkBitmap::kARGB_8888_Config);
+ }
+
mLocked.iconHotSpotX = hotSpotX;
mLocked.iconHotSpotY = hotSpotY;
mLocked.drawn = false;
diff --git a/services/java/com/android/server/ClipboardService.java b/services/java/com/android/server/ClipboardService.java
index bec35d162abf..062ab74ff406 100644
--- a/services/java/com/android/server/ClipboardService.java
+++ b/services/java/com/android/server/ClipboardService.java
@@ -140,7 +140,7 @@ public class ClipboardService extends IClipboard.Stub {
public boolean hasClipboardText() {
synchronized (this) {
if (mPrimaryClip != null) {
- CharSequence text = mPrimaryClip.getItem(0).getText();
+ CharSequence text = mPrimaryClip.getItemAt(0).getText();
return text != null && text.length() > 0;
}
return false;
@@ -175,7 +175,7 @@ public class ClipboardService extends IClipboard.Stub {
private final void checkDataOwnerLocked(ClipData data, int uid) {
final int N = data.getItemCount();
for (int i=0; i<N; i++) {
- checkItemOwnerLocked(data.getItem(i), uid);
+ checkItemOwnerLocked(data.getItemAt(i), uid);
}
}
@@ -214,7 +214,7 @@ public class ClipboardService extends IClipboard.Stub {
if (mPrimaryClip != null && !mActivePermissionOwners.contains(pkg)) {
final int N = mPrimaryClip.getItemCount();
for (int i=0; i<N; i++) {
- grantItemLocked(mPrimaryClip.getItem(i), pkg);
+ grantItemLocked(mPrimaryClip.getItemAt(i), pkg);
}
mActivePermissionOwners.add(pkg);
}
@@ -249,7 +249,7 @@ public class ClipboardService extends IClipboard.Stub {
}
final int N = mPrimaryClip.getItemCount();
for (int i=0; i<N; i++) {
- revokeItemLocked(mPrimaryClip.getItem(i));
+ revokeItemLocked(mPrimaryClip.getItemAt(i));
}
}
}
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index c0ce256b1db6..8a9e35180046 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -145,6 +145,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
int maximumFailedPasswordsForWipe = 0;
long passwordExpirationTimeout = 0L;
long passwordExpirationDate = 0L;
+ boolean encryptionRequested = false;
// TODO: review implementation decisions with frameworks team
boolean specifiesGlobalProxy = false;
@@ -242,6 +243,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
out.attribute(null, "value", Long.toString(passwordExpirationDate));
out.endTag(null, "password-expiration-date");
}
+ if (encryptionRequested) {
+ out.startTag(null, "encryption-requested");
+ out.attribute(null, "value", Boolean.toString(encryptionRequested));
+ out.endTag(null, "encryption-requested");
+ }
}
void readFromXml(XmlPullParser parser)
@@ -290,7 +296,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
maximumFailedPasswordsForWipe = Integer.parseInt(
parser.getAttributeValue(null, "value"));
} else if ("specifies-global-proxy".equals(tag)) {
- specifiesGlobalProxy = Boolean.getBoolean(
+ specifiesGlobalProxy = Boolean.parseBoolean(
parser.getAttributeValue(null, "value"));
} else if ("global-proxy-spec".equals(tag)) {
globalProxySpec =
@@ -304,6 +310,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
} else if ("password-expiration-date".equals(tag)) {
passwordExpirationDate = Long.parseLong(
parser.getAttributeValue(null, "value"));
+ } else if ("encryption-requested".equals(tag)) {
+ encryptionRequested = Boolean.parseBoolean(
+ parser.getAttributeValue(null, "value"));
} else {
Slog.w(TAG, "Unknown admin tag: " + tag);
}
@@ -356,6 +365,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
pw.print(prefix); pw.print("globalProxyEclusionList=");
pw.println(globalProxyExclusionList);
}
+ pw.print(prefix); pw.print("encryptionRequested=");
+ pw.println(encryptionRequested);
}
}
@@ -1823,7 +1834,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
/**
- * Set the storage encryption request.
+ * Set the storage encryption request for a single admin. Returns the new total request
+ * status (for all admins).
*/
public int setStorageEncryption(ComponentName who, boolean encrypt) {
synchronized (this) {
@@ -1834,29 +1846,94 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
ActiveAdmin ap = getActiveAdminForCallerLocked(who,
DeviceAdminInfo.USES_ENCRYPTED_STORAGE);
- // TODO: (1) Record the value for the admin so it's sticky
- // TODO: (2) Compute "max" for all admins (if any admin requests encryption, then
- // we enable it.
- // TODO: (3) Work with filesystem / mount service to start/stop encryption
- return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+ // Quick exit: If the filesystem does not support encryption, we can exit early.
+ if (!isEncryptionSupported()) {
+ return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+ }
+
+ // (1) Record the value for the admin so it's sticky
+ if (ap.encryptionRequested != encrypt) {
+ ap.encryptionRequested = encrypt;
+ saveSettingsLocked();
+ }
+
+ // (2) Compute "max" for all admins
+ boolean newRequested = false;
+ final int N = mAdminList.size();
+ for (int i = 0; i < N; i++) {
+ newRequested |= mAdminList.get(i).encryptionRequested;
+ }
+
+ // Notify OS of new request
+ setEncryptionRequested(newRequested);
+
+ // Return the new global request status
+ return newRequested
+ ? DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
+ : DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
}
}
/**
- * Get the current storage encryption status for a given storage domain.
+ * Get the current storage encryption request status for a given admin, or aggregate of all
+ * active admins.
*/
- public int getStorageEncryption(ComponentName who) {
+ public boolean getStorageEncryption(ComponentName who) {
synchronized (this) {
// Check for permissions if a particular caller is specified
if (who != null) {
- getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_ENCRYPTED_STORAGE);
+ // When checking for a single caller, status is based on caller's request
+ ActiveAdmin ap = getActiveAdminForCallerLocked(who,
+ DeviceAdminInfo.USES_ENCRYPTED_STORAGE);
+ return ap.encryptionRequested;
}
- // TODO: Work with filesystem / mount service to query encryption status
- return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+ // If no particular caller is specified, return the aggregate set of requests.
+ // This is short circuited by returning true on the first hit.
+ final int N = mAdminList.size();
+ for (int i = 0; i < N; i++) {
+ if (mAdminList.get(i).encryptionRequested) {
+ return true;
+ }
+ }
+ return false;
}
}
+ /**
+ * Get the current encryption status of the device.
+ */
+ public int getStorageEncryptionStatus() {
+ return getEncryptionStatus();
+ }
+
+ /**
+ * Hook to low-levels: This should report if the filesystem supports encrypted storage.
+ */
+ private boolean isEncryptionSupported() {
+ // Note, this can be implemented as
+ // return getEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+ // But is provided as a separate internal method if there's a faster way to do a
+ // simple check for supported-or-not.
+ return getEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+ }
+
+ /**
+ * Hook to low-levels: Reporting the current status of encryption.
+ * @return A value such as {@link DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED} or
+ * {@link DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE} or
+ * {@link DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE}.
+ */
+ private int getEncryptionStatus() {
+ return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+ }
+
+ /**
+ * Hook to low-levels: If needed, record the new admin setting for encryption.
+ */
+ private void setEncryptionRequested(boolean encrypt) {
+ }
+
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 4305c358919c..5c878c946231 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -97,10 +97,18 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
// Ensure that all log entries have a unique timestamp
private long mLastTimestamp = 0;
+ private volatile boolean mBooted = false;
+
/** Receives events that might indicate a need to clean up files. */
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
+ if (intent != null && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+ mBooted = true;
+ return;
+ }
+
+ // Else, for ACTION_DEVICE_STORAGE_LOW:
mCachedQuotaUptimeMillis = 0; // Force a re-check of quota size
// Run the initialization in the background (not this main thread).
@@ -132,7 +140,11 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
// Set up intent receivers
mContext = context;
mContentResolver = context.getContentResolver();
- context.registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW));
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW);
+ filter.addAction(Intent.ACTION_BOOT_COMPLETED);
+ context.registerReceiver(mReceiver, filter);
mContentResolver.registerContentObserver(
Settings.Secure.CONTENT_URI, true,
@@ -224,6 +236,9 @@ public final class DropBoxManagerService extends IDropBoxManagerService.Stub {
Intent dropboxIntent = new Intent(DropBoxManager.ACTION_DROPBOX_ENTRY_ADDED);
dropboxIntent.putExtra(DropBoxManager.EXTRA_TAG, tag);
dropboxIntent.putExtra(DropBoxManager.EXTRA_TIME, time);
+ if (!mBooted) {
+ dropboxIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
+ }
mContext.sendBroadcast(dropboxIntent, android.Manifest.permission.READ_LOGS);
} catch (IOException e) {
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 7b4f24697226..4d406209e74b 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -2049,8 +2049,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
for (int i = 0; i < N; ++i) {
InputMethodSubtype subtype = subtypes.get(i);
final String subtypeLocale = subtype.getLocale();
- // An applicable subtype should match "mode".
- if (subtypes.get(i).getMode().equalsIgnoreCase(mode)) {
+ // An applicable subtype should match "mode". If mode is null, mode will be ignored,
+ // and all subtypes with all modes can be candidates.
+ if (mode == null || subtypes.get(i).getMode().equalsIgnoreCase(mode)) {
if (firstMatchedModeSubtype == null) {
firstMatchedModeSubtype = subtype;
}
@@ -2175,11 +2176,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
InputMethodInfo imi = mMethodMap.get(lastInputMethodId);
if (imi != null) {
// If there are no selected subtypes, the framework will try to find
- // the most applicable subtype from all subtypes whose mode is
- // SUBTYPE_MODE_KEYBOARD. This is an exceptional case, so we will hardcode
- // the mode.
- mCurrentSubtype = findLastResortApplicableSubtypeLocked(
- mRes, imi.getSubtypes(), SUBTYPE_MODE_KEYBOARD, null, true);
+ // the most applicable subtype from explicitly or implicitly enabled
+ // subtypes.
+ List<InputMethodSubtype> explicitlyOrImplicitlyEnabledSubtypes =
+ getEnabledInputMethodSubtypeList(imi, true);
+ // If there is only one explicitly or implicitly enabled subtype,
+ // just returns it.
+ if (explicitlyOrImplicitlyEnabledSubtypes.size() == 1) {
+ mCurrentSubtype = explicitlyOrImplicitlyEnabledSubtypes.get(0);
+ } else if (explicitlyOrImplicitlyEnabledSubtypes.size() > 1) {
+ mCurrentSubtype = findLastResortApplicableSubtypeLocked(
+ mRes, explicitlyOrImplicitlyEnabledSubtypes,
+ SUBTYPE_MODE_KEYBOARD, null, true);
+ if (mCurrentSubtype == null) {
+ mCurrentSubtype = findLastResortApplicableSubtypeLocked(
+ mRes, explicitlyOrImplicitlyEnabledSubtypes, null, null,
+ true);
+ }
+ }
}
} else {
mCurrentSubtype =
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 19667d4a1be6..1eebd6aa361b 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4390,8 +4390,6 @@ class PackageManagerService extends IPackageManager.Stub {
}
};
- private static final boolean DEBUG_OBB = false;
-
private static final void sendPackageBroadcast(String action, String pkg,
Bundle extras, IIntentReceiver finishedReceiver) {
IActivityManager am = ActivityManagerNative.getDefault();
@@ -4641,64 +4639,6 @@ class PackageManagerService extends IPackageManager.Stub {
}
}
- public void setPackageObbPaths(String packageName, String[] paths) {
- if (DEBUG_OBB)
- Log.v(TAG, "Setting .obb paths for " + packageName + " to: " + Arrays.toString(paths));
- final int uid = Binder.getCallingUid();
- final int permission = mContext.checkCallingPermission(
- android.Manifest.permission.INSTALL_PACKAGES);
- final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
- if (!allowedByPermission) {
- throw new SecurityException("Permission denial: attempt to set .obb file from pid="
- + Binder.getCallingPid());
- }
- synchronized (mPackages) {
- final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
- if (pkgSetting == null) {
- throw new IllegalArgumentException("Unknown package: " + packageName);
- }
-
- if (paths != null) {
- if (paths.length == 0) {
- // Don't bother storing an empty array.
- paths = null;
- } else {
- // Don't allow the caller to manipulate our copy of the
- // list.
- paths = paths.clone();
- }
- }
-
- // Only write settings file if the new and old settings are not the
- // same.
- if (!Arrays.equals(paths, pkgSetting.obbPathStrings)) {
- pkgSetting.obbPathStrings = paths;
- mSettings.writeLP();
- }
- }
- }
-
- public String[] getPackageObbPaths(String packageName) {
- if (DEBUG_OBB)
- Log.v(TAG, "Getting .obb paths for " + packageName);
- final int uid = Binder.getCallingUid();
- final int permission = mContext.checkCallingPermission(
- android.Manifest.permission.INSTALL_PACKAGES);
- final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
- synchronized (mPackages) {
- final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
- if (pkgSetting == null) {
- throw new IllegalArgumentException("Unknown package: " + packageName);
- }
- if (!allowedByPermission && (uid != pkgSetting.userId)) {
- throw new SecurityException("Permission denial: attempt to set .obb file from pid="
- + Binder.getCallingPid() + ", uid=" + uid + ", package uid="
- + pkgSetting.userId);
- }
- return pkgSetting.obbPathStrings;
- }
- }
-
private void processPendingInstall(final InstallArgs args, final int currentStatus) {
// Queue up an async operation since the package installation may take a little while.
mHandler.post(new Runnable() {
@@ -4853,6 +4793,11 @@ class PackageManagerService extends IPackageManager.Stub {
.getExternalStorageAppMediaDirectory(mStats.packageName);
mStats.externalMediaSize = mContainerService
.calculateDirectorySize(externalCacheDir.getPath());
+
+ final File externalObbDir = Environment
+ .getExternalStorageAppObbDirectory(mStats.packageName);
+ mStats.externalObbSize = mContainerService.calculateDirectorySize(externalObbDir
+ .getPath());
}
}
@@ -7333,7 +7278,6 @@ class PackageManagerService extends IPackageManager.Stub {
pw.print(" codePath="); pw.println(ps.codePathString);
pw.print(" resourcePath="); pw.println(ps.resourcePathString);
pw.print(" nativeLibraryPath="); pw.println(ps.nativeLibraryPathString);
- pw.print(" obbPaths="); pw.println(Arrays.toString(ps.obbPathStrings));
pw.print(" versionCode="); pw.println(ps.versionCode);
if (ps.pkg != null) {
pw.print(" versionName="); pw.println(ps.pkg.mVersionName);
@@ -7917,7 +7861,6 @@ class PackageManagerService extends IPackageManager.Stub {
File resourcePath;
String resourcePathString;
String nativeLibraryPathString;
- String[] obbPathStrings;
long timeStamp;
long firstInstallTime;
long lastUpdateTime;
@@ -7963,11 +7906,6 @@ class PackageManagerService extends IPackageManager.Stub {
resourcePath = base.resourcePath;
resourcePathString = base.resourcePathString;
nativeLibraryPathString = base.nativeLibraryPathString;
-
- if (base.obbPathStrings != null) {
- obbPathStrings = base.obbPathStrings.clone();
- }
-
timeStamp = base.timeStamp;
firstInstallTime = base.firstInstallTime;
lastUpdateTime = base.lastUpdateTime;
@@ -9026,16 +8964,6 @@ class PackageManagerService extends IPackageManager.Stub {
if (pkg.installerPackageName != null) {
serializer.attribute(null, "installer", pkg.installerPackageName);
}
- if (pkg.obbPathStrings != null && pkg.obbPathStrings.length > 0) {
- int N = pkg.obbPathStrings.length;
- serializer.startTag(null, "obbs");
- for (int i = 0; i < N; i++) {
- serializer.startTag(null, "obb");
- serializer.attribute(null, "path", pkg.obbPathStrings[i]);
- serializer.endTag(null, "obb");
- }
- serializer.endTag(null, "obbs");
- }
pkg.signatures.writeXml(serializer, "sigs", mPastSignatures);
if ((pkg.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) {
serializer.startTag(null, "perms");
@@ -9628,8 +9556,6 @@ class PackageManagerService extends IPackageManager.Stub {
readGrantedPermissionsLP(parser,
packageSetting.grantedPermissions);
packageSetting.permissionsFixed = true;
- } else if (tagName.equals("obbs")) {
- readObbPathsLP(packageSetting, parser);
} else {
reportSettingsProblem(Log.WARN,
"Unknown element under <package>: "
@@ -9834,34 +9760,6 @@ class PackageManagerService extends IPackageManager.Stub {
}
}
- private void readObbPathsLP(PackageSettingBase packageSetting, XmlPullParser parser)
- throws XmlPullParserException, IOException {
- final List<String> obbPaths = new ArrayList<String>();
- final int outerDepth = parser.getDepth();
- int type;
- while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
- && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
- if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
- continue;
- }
-
- final String tagName = parser.getName();
- if (tagName.equals("obb")) {
- final String path = parser.getAttributeValue(null, "path");
- obbPaths.add(path);
- } else {
- reportSettingsProblem(Log.WARN, "Unknown element under <obbs>: "
- + parser.getName());
- }
- XmlUtils.skipCurrentTag(parser);
- }
- if (obbPaths.size() == 0) {
- return;
- } else {
- packageSetting.obbPathStrings = obbPaths.toArray(new String[obbPaths.size()]);
- }
- }
-
// Returns -1 if we could not find an available UserId to assign
private int newUserIdLP(Object obj) {
// Let's be stupidly inefficient for now...
diff --git a/services/java/com/android/server/UsbService.java b/services/java/com/android/server/UsbService.java
index 77ddf3b76e85..8ef03d436ad2 100644
--- a/services/java/com/android/server/UsbService.java
+++ b/services/java/com/android/server/UsbService.java
@@ -134,14 +134,17 @@ class UsbService {
mContext = context;
init(); // set initial status
- mUEventObserver.startObserving(USB_CONNECTED_MATCH);
- mUEventObserver.startObserving(USB_CONFIGURATION_MATCH);
- mUEventObserver.startObserving(USB_FUNCTIONS_MATCH);
+ if (mConfiguration >= 0) {
+ mUEventObserver.startObserving(USB_CONNECTED_MATCH);
+ mUEventObserver.startObserving(USB_CONFIGURATION_MATCH);
+ mUEventObserver.startObserving(USB_FUNCTIONS_MATCH);
+ }
}
private final void init() {
char[] buffer = new char[1024];
+ mConfiguration = -1;
try {
FileReader file = new FileReader(USB_CONNECTED_PATH);
int len = file.read(buffer, 0, 1024);
@@ -154,10 +157,12 @@ class UsbService {
mConfiguration = Integer.valueOf((new String(buffer, 0, len)).trim());
} catch (FileNotFoundException e) {
- Slog.w(TAG, "This kernel does not have USB configuration switch support");
+ Slog.i(TAG, "This kernel does not have USB configuration switch support");
} catch (Exception e) {
Slog.e(TAG, "" , e);
}
+ if (mConfiguration < 0)
+ return;
try {
File[] files = new File(USB_COMPOSITE_CLASS_PATH).listFiles();
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 1b3725c4d051..3e930aeb085d 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -3031,7 +3031,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
- if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
+ (lp != null ? lp.packageName : null)
+ " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
if (lp != null && lp.windowAnimations != 0) {
@@ -3052,7 +3052,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
- if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: params package="
+ if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: package="
+ packageName + " resId=0x" + Integer.toHexString(resId));
if (packageName != null) {
if ((resId&0xFF000000) == 0x01000000) {
@@ -9957,8 +9957,8 @@ public class WindowManagerService extends IWindowManager.Stub
// The top-most window will supply the layout params,
// and we will determine it below.
LayoutParams animLp = null;
- AppWindowToken animToken = null;
int bestAnimLayer = -1;
+ boolean fullscreenAnim = false;
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"New wallpaper target=" + mWallpaperTarget
@@ -10000,11 +10000,18 @@ public class WindowManagerService extends IWindowManager.Stub
// window, we will always use its anim.
if ((ws.mAttrs.flags&FLAG_COMPATIBLE_WINDOW) != 0) {
animLp = ws.mAttrs;
- animToken = ws.mAppToken;
bestAnimLayer = Integer.MAX_VALUE;
- } else if (ws.mLayer > bestAnimLayer) {
+ } else if (!fullscreenAnim || ws.mLayer > bestAnimLayer) {
+ animLp = ws.mAttrs;
+ bestAnimLayer = ws.mLayer;
+ }
+ fullscreenAnim = true;
+ }
+ } else if (!fullscreenAnim) {
+ WindowState ws = wtoken.findMainWindow();
+ if (ws != null) {
+ if (ws.mLayer > bestAnimLayer) {
animLp = ws.mAttrs;
- animToken = ws.mAppToken;
bestAnimLayer = ws.mLayer;
}
}
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index 134b91edd7b6..dd9db9a2b059 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -1233,18 +1233,18 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
for (String iface : ifaces) {
for (String regex : mUpstreamIfaceRegexs) {
if (iface.matches(regex)) {
- // verify it is up!
+ // verify it is active
InterfaceConfiguration ifcg = null;
try {
ifcg = service.getInterfaceConfig(iface);
+ if (ifcg.isActive()) {
+ return iface;
+ }
} catch (Exception e) {
Log.e(TAG, "Error getting iface config :" + e);
// ignore - try next
continue;
}
- if (ifcg.interfaceFlags.contains("up")) {
- return iface;
- }
}
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 2c5aa3c9a83b..19e7faeaeb88 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -152,9 +152,16 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
- Log.i("CdmaServiceStateTracker", "Auto time state called ...");
- revertToNitz();
+ Log.i("CdmaServiceStateTracker", "Auto time state changed");
+ revertToNitzTime();
+ }
+ };
+ private ContentObserver mAutoTimeZoneObserver = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ Log.i("CdmaServiceStateTracker", "Auto time zone state changed");
+ revertToNitzTimeZone();
}
};
@@ -194,6 +201,9 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
mAutoTimeObserver);
+ cr.registerContentObserver(
+ Settings.System.getUriFor(Settings.System.AUTO_TIME_ZONE), true,
+ mAutoTimeZoneObserver);
setSignalStrengthDefaultValues();
mNeedToRegForRuimLoaded = true;
@@ -212,6 +222,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
cm.unSetOnSignalStrengthUpdate(this);
cm.unSetOnNITZTime(this);
cr.unregisterContentObserver(this.mAutoTimeObserver);
+ cr.unregisterContentObserver(this.mAutoTimeZoneObserver);
}
@Override
@@ -1582,20 +1593,29 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
phone.getContext().sendStickyBroadcast(intent);
}
- private void revertToNitz() {
+ private void revertToNitzTime() {
if (Settings.System.getInt(cr, Settings.System.AUTO_TIME, 0) == 0) {
return;
}
- Log.d(LOG_TAG, "Reverting to NITZ: tz='" + mSavedTimeZone
- + "' mSavedTime=" + mSavedTime
+ Log.d(LOG_TAG, "Reverting to NITZ Time: mSavedTime=" + mSavedTime
+ " mSavedAtTime=" + mSavedAtTime);
- if (mSavedTimeZone != null && mSavedTime != 0 && mSavedAtTime != 0) {
- setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ if (mSavedTime != 0 && mSavedAtTime != 0) {
setAndBroadcastNetworkSetTime(mSavedTime
+ (SystemClock.elapsedRealtime() - mSavedAtTime));
}
}
+ private void revertToNitzTimeZone() {
+ if (Settings.System.getInt(phone.getContext().getContentResolver(),
+ Settings.System.AUTO_TIME_ZONE, 0) == 0) {
+ return;
+ }
+ Log.d(LOG_TAG, "Reverting to NITZ TimeZone: tz='" + mSavedTimeZone);
+ if (mSavedTimeZone != null) {
+ setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ }
+ }
+
private boolean isSidsAllZeros() {
if (mHomeSystemId != null) {
for (int i=0; i < mHomeSystemId.length; i++) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index b04d4b930b8a..c107d174919f 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -181,7 +181,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
@Override
public void onChange(boolean selfChange) {
Log.i("GsmServiceStateTracker", "Auto time state changed");
- revertToNitz();
+ revertToNitzTime();
+ }
+ };
+
+ private ContentObserver mAutoTimeZoneObserver = new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ Log.i("GsmServiceStateTracker", "Auto time zone state changed");
+ revertToNitzTimeZone();
}
};
@@ -220,6 +228,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
cr.registerContentObserver(
Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
mAutoTimeObserver);
+ cr.registerContentObserver(
+ Settings.System.getUriFor(Settings.System.AUTO_TIME_ZONE), true,
+ mAutoTimeZoneObserver);
+
setSignalStrengthDefaultValues();
mNeedToRegForSimLoaded = true;
@@ -244,6 +256,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
cm.unSetOnRestrictedStateChanged(this);
cm.unSetOnNITZTime(this);
cr.unregisterContentObserver(this.mAutoTimeObserver);
+ cr.unregisterContentObserver(this.mAutoTimeZoneObserver);
}
protected void finalize() {
@@ -1613,21 +1626,30 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
phone.getContext().sendStickyBroadcast(intent);
}
- private void revertToNitz() {
+ private void revertToNitzTime() {
if (Settings.System.getInt(phone.getContext().getContentResolver(),
Settings.System.AUTO_TIME, 0) == 0) {
return;
}
- Log.d(LOG_TAG, "Reverting to NITZ: tz='" + mSavedTimeZone
- + "' mSavedTime=" + mSavedTime
+ Log.d(LOG_TAG, "Reverting to NITZ Time: mSavedTime=" + mSavedTime
+ " mSavedAtTime=" + mSavedAtTime);
- if (mSavedTimeZone != null && mSavedTime != 0 && mSavedAtTime != 0) {
- setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ if (mSavedTime != 0 && mSavedAtTime != 0) {
setAndBroadcastNetworkSetTime(mSavedTime
+ (SystemClock.elapsedRealtime() - mSavedAtTime));
}
}
+ private void revertToNitzTimeZone() {
+ if (Settings.System.getInt(phone.getContext().getContentResolver(),
+ Settings.System.AUTO_TIME_ZONE, 0) == 0) {
+ return;
+ }
+ Log.d(LOG_TAG, "Reverting to NITZ TimeZone: tz='" + mSavedTimeZone);
+ if (mSavedTimeZone != null) {
+ setAndBroadcastNetworkSetTimeZone(mSavedTimeZone);
+ }
+ }
+
/**
* Post a notification to NotificationManager for restricted state
*
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index 2e4199e27bce..0d20496dd3e5 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -495,18 +495,4 @@ public class MockPackageManager extends PackageManager {
public boolean isSafeMode() {
throw new UnsupportedOperationException();
}
-
- public void setPackageObbPath(String packageName, String path) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setPackageObbPaths(String packageName, String[] paths) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String[] getPackageObbPaths(String packageName) {
- throw new UnsupportedOperationException();
- }
}
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index 7099ab57a812..691aff2866c3 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -166,6 +166,15 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+
+ <activity
+ android:name="BitmapsSkewActivity"
+ android:label="_BitmapsSkew">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
<activity
android:name="BitmapsAlphaActivity"
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
index 405435302f45..607a1738c13a 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
@@ -25,6 +25,7 @@ import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.os.Bundle;
+import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
@@ -61,7 +62,15 @@ public class BitmapsActivity extends Activity {
mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
mBitmap2 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset2);
+
+ Log.d("Bitmap", "mBitmap1.isMutable() = " + mBitmap1.isMutable());
+ Log.d("Bitmap", "mBitmap2.isMutable() = " + mBitmap2.isMutable());
+ BitmapFactory.Options opts = new BitmapFactory.Options();
+ opts.inMutable = true;
+ Bitmap bitmap = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1, opts);
+ Log.d("Bitmap", "bitmap.isMutable() = " + bitmap.isMutable());
+
mBitmapPaint = new Paint();
mDstIn = new PorterDuffXfermode(PorterDuff.Mode.DST_IN);
}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java
new file mode 100644
index 000000000000..099c0dde4eac
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsSkewActivity.java
@@ -0,0 +1,56 @@
+/*
+ * 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 com.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.view.View;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class BitmapsSkewActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final BitmapsView view = new BitmapsView(this);
+ setContentView(view);
+ }
+
+ static class BitmapsView extends View {
+ private Paint mBitmapPaint;
+ private final Bitmap mBitmap1;
+
+ BitmapsView(Context c) {
+ super(c);
+
+ mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ canvas.translate(120.0f, 50.0f);
+ canvas.skew(0.2f, 0.3f);
+ canvas.drawBitmap(mBitmap1, 0.0f, 0.0f, mBitmapPaint);
+ }
+ }
+}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
index 1b79cb60097b..e7f431c48a1b 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextActivity.java
@@ -37,6 +37,7 @@ public class TextActivity extends Activity {
private final Paint mLargePaint;
private final Paint mStrikePaint;
private final Paint mScaledPaint;
+ private final Paint mSkewPaint;
CustomTextView(Context c) {
super(c);
@@ -57,6 +58,10 @@ public class TextActivity extends Activity {
mScaledPaint = new Paint();
mScaledPaint.setAntiAlias(true);
mScaledPaint.setTextSize(16.0f);
+
+ mSkewPaint = new Paint();
+ mSkewPaint.setAntiAlias(true);
+ mSkewPaint.setTextSize(16.0f);
}
@Override
@@ -100,11 +105,18 @@ public class TextActivity extends Activity {
mStrikePaint.setStrikeThruText(false);
mStrikePaint.setUnderlineText(true);
+ mSkewPaint.setTextSkewX(-0.25f);
+ canvas.drawText("Hello OpenGL renderer!", 680, 200, mSkewPaint);
+ mSkewPaint.setTextSkewX(0.5f);
+ canvas.drawText("Hello OpenGL renderer!", 680, 230, mSkewPaint);
+ mSkewPaint.setTextSkewX(0.0f);
+ canvas.drawText("Hello OpenGL renderer!", 680, 260, mSkewPaint);
+
mScaledPaint.setTextScaleX(0.5f);
canvas.drawText("Hello OpenGL renderer!", 500, 200, mScaledPaint);
- mScaledPaint.setTextScaleX(2.0f);
- canvas.drawText("Hello OpenGL renderer!", 500, 230, mScaledPaint);
mScaledPaint.setTextScaleX(1.0f);
+ canvas.drawText("Hello OpenGL renderer!", 500, 230, mScaledPaint);
+ mScaledPaint.setTextScaleX(2.0f);
canvas.drawText("Hello OpenGL renderer!", 500, 260, mScaledPaint);
canvas.save();
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ViewLayersActivity2.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ViewLayersActivity2.java
index a0b1d782d723..e795f02a224d 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/ViewLayersActivity2.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ViewLayersActivity2.java
@@ -38,6 +38,8 @@ public class ViewLayersActivity2 extends Activity {
setupList(R.id.list1);
setupList(R.id.list2);
setupList(R.id.list3);
+
+ findViewById(R.id.list1).setAlpha(0.7f);
}
private void setupList(int listId) {
diff --git a/tools/layoutlib/bridge/src/com/android/ide/common/resources/ResourceResolver.java b/tools/layoutlib/bridge/src/com/android/ide/common/resources/ResourceResolver.java
deleted file mode 100644
index 4c500e75cbc8..000000000000
--- a/tools/layoutlib/bridge/src/com/android/ide/common/resources/ResourceResolver.java
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * 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.ide.common.resources;
-
-import com.android.ide.common.rendering.api.LayoutLog;
-import com.android.ide.common.rendering.api.ResourceValue;
-import com.android.ide.common.rendering.api.StyleResourceValue;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ResourceResolver {
-
- public final static String RES_ANIMATOR = "animator";
- public final static String RES_STYLE = "style";
- public final static String RES_ATTR = "attr";
- public final static String RES_DIMEN = "dimen";
- public final static String RES_DRAWABLE = "drawable";
- public final static String RES_COLOR = "color";
- public final static String RES_LAYOUT = "layout";
- public final static String RES_STRING = "string";
- public final static String RES_ID = "id";
-
- public final static String REFERENCE_NULL = "@null";
-
- private final static String REFERENCE_STYLE = RES_STYLE + "/";
- private final static String PREFIX_ANDROID_RESOURCE_REF = "@android:";
- private final static String PREFIX_RESOURCE_REF = "@";
- private final static String PREFIX_ANDROID_THEME_REF = "?android:";
- private final static String PREFIX_THEME_REF = "?";
- private final static String PREFIX_ANDROID = "android:";
-
-
- private final IFrameworkResourceIdProvider mFrameworkProvider;
- private final Map<String, Map<String, ResourceValue>> mProjectResources;
- private final Map<String, Map<String, ResourceValue>> mFrameworkResources;
- private final LayoutLog mLogger;
-
- private final Map<StyleResourceValue, StyleResourceValue> mStyleInheritanceMap =
- new HashMap<StyleResourceValue, StyleResourceValue>();
- private StyleResourceValue mTheme;
-
- public interface IFrameworkResourceIdProvider {
- Integer getId(String resType, String resName);
- }
-
- private ResourceResolver(
- IFrameworkResourceIdProvider provider,
- Map<String, Map<String, ResourceValue>> projectResources,
- Map<String, Map<String, ResourceValue>> frameworkResources,
- LayoutLog logger) {
- mFrameworkProvider = provider;
- mProjectResources = projectResources;
- mFrameworkResources = frameworkResources;
- mLogger = logger;
- }
-
- /**
- * Creates a new ResourceResolver object.
- *
- * @param IFrameworkResourceIdProvider an optional framework resource ID provider
- * @param projectResources the project resources.
- * @param frameworkResources the framework resources.
- * @param themeName the name of the current theme.
- * @param isProjectTheme Is this a project theme?
- * @return
- */
- public static ResourceResolver create(
- IFrameworkResourceIdProvider provider,
- Map<String, Map<String, ResourceValue>> projectResources,
- Map<String, Map<String, ResourceValue>> frameworkResources,
- String themeName, boolean isProjectTheme, LayoutLog logger) {
-
- ResourceResolver resolver = new ResourceResolver(provider,
- projectResources, frameworkResources,
- logger);
-
- resolver.computeStyleMaps(themeName, isProjectTheme);
-
- return resolver;
- }
-
- public StyleResourceValue getTheme() {
- return mTheme;
- }
-
- /**
- * Returns a framework resource by type and name. The returned resource is resolved.
- * @param resourceType the type of the resource
- * @param resourceName the name of the resource
- */
- public ResourceValue getFrameworkResource(String resourceType, String resourceName) {
- return getResource(resourceType, resourceName, mFrameworkResources);
- }
-
- /**
- * Returns a project resource by type and name. The returned resource is resolved.
- * @param resourceType the type of the resource
- * @param resourceName the name of the resource
- */
- public ResourceValue getProjectResource(String resourceType, String resourceName) {
- return getResource(resourceType, resourceName, mProjectResources);
- }
-
- /**
- * Returns the {@link ResourceValue} matching a given name in the current theme. If the
- * item is not directly available in the theme, the method looks in its parent theme.
- *
- * @param itemName the name of the item to search for.
- * @return the {@link ResourceValue} object or <code>null</code>
- */
- public ResourceValue findItemInTheme(String itemName) {
- if (mTheme != null) {
- return findItemInStyle(mTheme, itemName);
- }
-
- return null;
- }
-
- /**
- * Returns the {@link ResourceValue} matching a given name in a given style. If the
- * item is not directly available in the style, the method looks in its parent style.
- *
- * @param style the style to search in
- * @param itemName the name of the item to search for.
- * @return the {@link ResourceValue} object or <code>null</code>
- */
- public ResourceValue findItemInStyle(StyleResourceValue style, String itemName) {
- ResourceValue item = style.findValue(itemName);
-
- // if we didn't find it, we look in the parent style (if applicable)
- if (item == null && mStyleInheritanceMap != null) {
- StyleResourceValue parentStyle = mStyleInheritanceMap.get(style);
- if (parentStyle != null) {
- return findItemInStyle(parentStyle, itemName);
- }
- }
-
- return item;
- }
-
- /**
- * Searches for, and returns a {@link ResourceValue} by its reference.
- * <p/>
- * The reference format can be:
- * <pre>@resType/resName</pre>
- * <pre>@android:resType/resName</pre>
- * <pre>@resType/android:resName</pre>
- * <pre>?resType/resName</pre>
- * <pre>?android:resType/resName</pre>
- * <pre>?resType/android:resName</pre>
- * Any other string format will return <code>null</code>.
- * <p/>
- * The actual format of a reference is <pre>@[namespace:]resType/resName</pre> but this method
- * only support the android namespace.
- *
- * @param reference the resource reference to search for.
- * @param forceFrameworkOnly if true all references are considered to be toward framework
- * resource even if the reference does not include the android: prefix.
- * @return a {@link ResourceValue} or <code>null</code>.
- */
- public ResourceValue findResValue(String reference, boolean forceFrameworkOnly) {
- if (reference == null) {
- return null;
- }
- if (reference.startsWith(PREFIX_THEME_REF)) {
- // no theme? no need to go further!
- if (mTheme == null) {
- return null;
- }
-
- boolean frameworkOnly = false;
-
- // eliminate the prefix from the string
- if (reference.startsWith(PREFIX_ANDROID_THEME_REF)) {
- frameworkOnly = true;
- reference = reference.substring(PREFIX_ANDROID_THEME_REF.length());
- } else {
- reference = reference.substring(PREFIX_THEME_REF.length());
- }
-
- // at this point, value can contain type/name (drawable/foo for instance).
- // split it to make sure.
- String[] segments = reference.split("\\/");
-
- // we look for the referenced item name.
- String referenceName = null;
-
- if (segments.length == 2) {
- // there was a resType in the reference. If it's attr, we ignore it
- // else, we assert for now.
- if (RES_ATTR.equals(segments[0])) {
- referenceName = segments[1];
- } else {
- // At this time, no support for ?type/name where type is not "attr"
- return null;
- }
- } else {
- // it's just an item name.
- referenceName = segments[0];
- }
-
- // now we look for android: in the referenceName in order to support format
- // such as: ?attr/android:name
- if (referenceName.startsWith(PREFIX_ANDROID)) {
- frameworkOnly = true;
- referenceName = referenceName.substring(PREFIX_ANDROID.length());
- }
-
- // Now look for the item in the theme, starting with the current one.
- if (frameworkOnly) {
- // FIXME for now we do the same as if it didn't specify android:
- return findItemInStyle(mTheme, referenceName);
- }
-
- return findItemInStyle(mTheme, referenceName);
- } else if (reference.startsWith(PREFIX_RESOURCE_REF)) {
- boolean frameworkOnly = false;
-
- // check for the specific null reference value.
- if (REFERENCE_NULL.equals(reference)) {
- return null;
- }
-
- // Eliminate the prefix from the string.
- if (reference.startsWith(PREFIX_ANDROID_RESOURCE_REF)) {
- frameworkOnly = true;
- reference = reference.substring(
- PREFIX_ANDROID_RESOURCE_REF.length());
- } else {
- reference = reference.substring(PREFIX_RESOURCE_REF.length());
- }
-
- // at this point, value contains type/[android:]name (drawable/foo for instance)
- String[] segments = reference.split("\\/");
-
- // now we look for android: in the resource name in order to support format
- // such as: @drawable/android:name
- if (segments[1].startsWith(PREFIX_ANDROID)) {
- frameworkOnly = true;
- segments[1] = segments[1].substring(PREFIX_ANDROID.length());
- }
-
- return findResValue(segments[0], segments[1],
- forceFrameworkOnly ? true :frameworkOnly);
- }
-
- // Looks like the value didn't reference anything. Return null.
- return null;
- }
-
- /**
- * Resolves the value of a resource, if the value references a theme or resource value.
- * <p/>
- * This method ensures that it returns a {@link ResourceValue} object that does not
- * reference another resource.
- * If the resource cannot be resolved, it returns <code>null</code>.
- * <p/>
- * If a value that does not need to be resolved is given, the method will return a new
- * instance of {@link ResourceValue} that contains the input value.
- *
- * @param type the type of the resource
- * @param name the name of the attribute containing this value.
- * @param value the resource value, or reference to resolve
- * @param isFrameworkValue whether the value is a framework value.
- *
- * @return the resolved resource value or <code>null</code> if it failed to resolve it.
- */
- public ResourceValue resolveValue(String type, String name, String value,
- boolean isFrameworkValue) {
- if (value == null) {
- return null;
- }
-
- // get the ResourceValue referenced by this value
- ResourceValue resValue = findResValue(value, isFrameworkValue);
-
- // if resValue is null, but value is not null, this means it was not a reference.
- // we return the name/value wrapper in a ResourceValue. the isFramework flag doesn't
- // matter.
- if (resValue == null) {
- return new ResourceValue(type, name, value, isFrameworkValue);
- }
-
- // we resolved a first reference, but we need to make sure this isn't a reference also.
- return resolveResValue(resValue);
- }
-
- /**
- * Returns the {@link ResourceValue} referenced by the value of <var>value</var>.
- * <p/>
- * This method ensures that it returns a {@link ResourceValue} object that does not
- * reference another resource.
- * If the resource cannot be resolved, it returns <code>null</code>.
- * <p/>
- * If a value that does not need to be resolved is given, the method will return the input
- * value.
- *
- * @param value the value containing the reference to resolve.
- * @return a {@link ResourceValue} object or <code>null</code>
- */
- public ResourceValue resolveResValue(ResourceValue value) {
- if (value == null) {
- return null;
- }
-
- // if the resource value is a style, we simply return it.
- if (value instanceof StyleResourceValue) {
- return value;
- }
-
- // else attempt to find another ResourceValue referenced by this one.
- ResourceValue resolvedValue = findResValue(value.getValue(), value.isFramework());
-
- // if the value did not reference anything, then we simply return the input value
- if (resolvedValue == null) {
- return value;
- }
-
- // otherwise, we attempt to resolve this new value as well
- return resolveResValue(resolvedValue);
- }
-
-
- /**
- * Searches for, and returns a {@link ResourceValue} by its name, and type.
- * @param resType the type of the resource
- * @param resName the name of the resource
- * @param frameworkOnly if <code>true</code>, the method does not search in the
- * project resources
- */
- private ResourceValue findResValue(String resType, String resName, boolean frameworkOnly) {
- // map of ResouceValue for the given type
- Map<String, ResourceValue> typeMap;
-
- // if allowed, search in the project resources first.
- if (frameworkOnly == false) {
- typeMap = mProjectResources.get(resType);
- if (typeMap != null) {
- ResourceValue item = typeMap.get(resName);
- if (item != null) {
- return item;
- }
- }
- }
-
- // now search in the framework resources.
- typeMap = mFrameworkResources.get(resType);
- if (typeMap != null) {
- ResourceValue item = typeMap.get(resName);
- if (item != null) {
- return item;
- }
-
- // if it was not found and the type is an id, it is possible that the ID was
- // generated dynamically when compiling the framework resources.
- // Look for it in the R map.
- if (mFrameworkProvider != null && RES_ID.equals(resType)) {
- if (mFrameworkProvider.getId(resType, resName) != null) {
- return new ResourceValue(resType, resName, true);
- }
- }
- }
-
- // didn't find the resource anywhere.
- // This is normal if the resource is an ID that is generated automatically.
- // For other resources, we output a warning
- if ("+id".equals(resType) == false && "+android:id".equals(resType) == false) { //$NON-NLS-1$ //$NON-NLS-2$
- mLogger.warning(LayoutLog.TAG_RESOURCES_RESOLVE,
- "Couldn't resolve resource @" +
- (frameworkOnly ? "android:" : "") + resType + "/" + resName,
- new ResourceValue(resType, resName, frameworkOnly));
- }
- return null;
- }
-
- ResourceValue getResource(String resourceType, String resourceName,
- Map<String, Map<String, ResourceValue>> resourceRepository) {
- Map<String, ResourceValue> typeMap = resourceRepository.get(resourceType);
- if (typeMap != null) {
- ResourceValue item = typeMap.get(resourceName);
- if (item != null) {
- item = resolveResValue(item);
- return item;
- }
- }
-
- // didn't find the resource anywhere.
- return null;
-
- }
-
- /**
- * Compute style information from the given list of style for the project and framework.
- * @param themeName the name of the current theme.
- * @param isProjectTheme Is this a project theme?
- */
- private void computeStyleMaps(String themeName, boolean isProjectTheme) {
- Map<String, ResourceValue> projectStyleMap = mProjectResources.get(RES_STYLE);
- Map<String, ResourceValue> frameworkStyleMap = mFrameworkResources.get(RES_STYLE);
-
- if (projectStyleMap != null && frameworkStyleMap != null) {
- // first, get the theme
- ResourceValue theme = null;
-
- // project theme names have been prepended with a *
- if (isProjectTheme) {
- theme = projectStyleMap.get(themeName);
- } else {
- theme = frameworkStyleMap.get(themeName);
- }
-
- if (theme instanceof StyleResourceValue) {
- // compute the inheritance map for both the project and framework styles
- computeStyleInheritance(projectStyleMap.values(), projectStyleMap,
- frameworkStyleMap);
-
- // Compute the style inheritance for the framework styles/themes.
- // Since, for those, the style parent values do not contain 'android:'
- // we want to force looking in the framework style only to avoid using
- // similarly named styles from the project.
- // To do this, we pass null in lieu of the project style map.
- computeStyleInheritance(frameworkStyleMap.values(), null /*inProjectStyleMap */,
- frameworkStyleMap);
-
- mTheme = (StyleResourceValue) theme;
- }
- }
- }
-
-
-
- /**
- * Compute the parent style for all the styles in a given list.
- * @param styles the styles for which we compute the parent.
- * @param inProjectStyleMap the map of project styles.
- * @param inFrameworkStyleMap the map of framework styles.
- * @param outInheritanceMap the map of style inheritance. This is filled by the method.
- */
- private void computeStyleInheritance(Collection<ResourceValue> styles,
- Map<String, ResourceValue> inProjectStyleMap,
- Map<String, ResourceValue> inFrameworkStyleMap) {
- for (ResourceValue value : styles) {
- if (value instanceof StyleResourceValue) {
- StyleResourceValue style = (StyleResourceValue)value;
- StyleResourceValue parentStyle = null;
-
- // first look for a specified parent.
- String parentName = style.getParentStyle();
-
- // no specified parent? try to infer it from the name of the style.
- if (parentName == null) {
- parentName = getParentName(value.getName());
- }
-
- if (parentName != null) {
- parentStyle = getStyle(parentName, inProjectStyleMap, inFrameworkStyleMap);
-
- if (parentStyle != null) {
- mStyleInheritanceMap.put(style, parentStyle);
- }
- }
- }
- }
- }
-
-
- /**
- * Computes the name of the parent style, or <code>null</code> if the style is a root style.
- */
- private String getParentName(String styleName) {
- int index = styleName.lastIndexOf('.');
- if (index != -1) {
- return styleName.substring(0, index);
- }
-
- return null;
- }
-
- /**
- * Searches for and returns the {@link StyleResourceValue} from a given name.
- * <p/>The format of the name can be:
- * <ul>
- * <li>[android:]&lt;name&gt;</li>
- * <li>[android:]style/&lt;name&gt;</li>
- * <li>@[android:]style/&lt;name&gt;</li>
- * </ul>
- * @param parentName the name of the style.
- * @param inProjectStyleMap the project style map. Can be <code>null</code>
- * @param inFrameworkStyleMap the framework style map.
- * @return The matching {@link StyleResourceValue} object or <code>null</code> if not found.
- */
- private StyleResourceValue getStyle(String parentName,
- Map<String, ResourceValue> inProjectStyleMap,
- Map<String, ResourceValue> inFrameworkStyleMap) {
- boolean frameworkOnly = false;
-
- String name = parentName;
-
- // remove the useless @ if it's there
- if (name.startsWith(PREFIX_RESOURCE_REF)) {
- name = name.substring(PREFIX_RESOURCE_REF.length());
- }
-
- // check for framework identifier.
- if (name.startsWith(PREFIX_ANDROID)) {
- frameworkOnly = true;
- name = name.substring(PREFIX_ANDROID.length());
- }
-
- // at this point we could have the format <type>/<name>. we want only the name as long as
- // the type is style.
- if (name.startsWith(REFERENCE_STYLE)) {
- name = name.substring(REFERENCE_STYLE.length());
- } else if (name.indexOf('/') != -1) {
- return null;
- }
-
- ResourceValue parent = null;
-
- // if allowed, search in the project resources.
- if (frameworkOnly == false && inProjectStyleMap != null) {
- parent = inProjectStyleMap.get(name);
- }
-
- // if not found, then look in the framework resources.
- if (parent == null) {
- parent = inFrameworkStyleMap.get(name);
- }
-
- // make sure the result is the proper class type and return it.
- if (parent instanceof StyleResourceValue) {
- return (StyleResourceValue)parent;
- }
-
- assert false;
- mLogger.error(LayoutLog.TAG_RESOURCES_RESOLVE,
- String.format("Unable to resolve parent style name: %s", parentName),
- null /*data*/);
-
- return null;
- }
-
-
-}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index f6332016d73a..8d194925652d 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -18,9 +18,9 @@ package com.android.layoutlib.bridge.android;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.rendering.api.StyleResourceValue;
-import com.android.ide.common.resources.ResourceResolver;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.BridgeConstants;
import com.android.layoutlib.bridge.impl.Stack;
@@ -74,12 +74,13 @@ import java.util.Map.Entry;
*/
public final class BridgeContext extends Activity {
- private Resources mResources;
+ private Resources mSystemResources;
private Theme mTheme;
private final HashMap<View, Object> mViewKeyMap = new HashMap<View, Object>();
private final Object mProjectKey;
private final DisplayMetrics mMetrics;
- private final ResourceResolver mResourceResolver;
+ private final RenderResources mRenderResources;
+ private final ApplicationInfo mApplicationInfo;
private final Map<Object, Map<String, String>> mDefaultPropMaps =
new IdentityHashMap<Object, Map<String,String>>();
@@ -112,18 +113,23 @@ public final class BridgeContext extends Activity {
* value is the resource value.
* @param styleInheritanceMap
* @param projectCallback
+ * @param targetSdkVersion the targetSdkVersion of the application.
*/
public BridgeContext(Object projectKey, DisplayMetrics metrics,
- ResourceResolver resourceResolver,
- IProjectCallback projectCallback) {
+ RenderResources renderResources,
+ IProjectCallback projectCallback,
+ int targetSdkVersion) {
mProjectKey = projectKey;
mMetrics = metrics;
mProjectCallback = projectCallback;
- mResourceResolver = resourceResolver;
+ mRenderResources = renderResources;
mFragments.mCurState = Fragment.CREATED;
mFragments.mActivity = this;
+
+ mApplicationInfo = new ApplicationInfo();
+ mApplicationInfo.targetSdkVersion = targetSdkVersion;
}
/**
@@ -136,13 +142,13 @@ public final class BridgeContext extends Activity {
AssetManager assetManager = AssetManager.getSystem();
Configuration config = new Configuration();
- mResources = BridgeResources.initSystem(
+ mSystemResources = BridgeResources.initSystem(
this,
assetManager,
mMetrics,
config,
mProjectCallback);
- mTheme = mResources.newTheme();
+ mTheme = mSystemResources.newTheme();
}
/**
@@ -172,8 +178,8 @@ public final class BridgeContext extends Activity {
return mProjectCallback;
}
- public ResourceResolver getResolver() {
- return mResourceResolver;
+ public RenderResources getRenderResources() {
+ return mRenderResources;
}
public Map<String, String> getDefaultPropMap(Object key) {
@@ -225,7 +231,7 @@ public final class BridgeContext extends Activity {
@Override
public Resources getResources() {
- return mResources;
+ return mSystemResources;
}
@Override
@@ -261,7 +267,7 @@ public final class BridgeContext extends Activity {
@Override
public final TypedArray obtainStyledAttributes(int[] attrs) {
- return createStyleBasedTypedArray(mResourceResolver.getTheme(), attrs);
+ return createStyleBasedTypedArray(mRenderResources.getTheme(), attrs);
}
@Override
@@ -346,7 +352,7 @@ public final class BridgeContext extends Activity {
boolean[] frameworkAttributes = new boolean[1];
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
- BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
+ BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
isPlatformFile);
// resolve the defStyleAttr value into a IStyleResourceValue
@@ -358,7 +364,7 @@ public final class BridgeContext extends Activity {
customStyle = set.getAttributeValue(null /* namespace*/, "style");
}
if (customStyle != null) {
- ResourceValue item = mResourceResolver.findResValue(customStyle,
+ ResourceValue item = mRenderResources.findResValue(customStyle,
false /*forceFrameworkOnly*/);
if (item instanceof StyleResourceValue) {
@@ -375,11 +381,11 @@ public final class BridgeContext extends Activity {
}
// look for the style in the current theme, and its parent:
- ResourceValue item = mResourceResolver.findItemInTheme(defStyleName);
+ ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
if (item != null) {
// item is a reference to a style entry. Search for it.
- item = mResourceResolver.findResValue(item.getValue(),
+ item = mRenderResources.findResValue(item.getValue(),
false /*forceFrameworkOnly*/);
if (item instanceof StyleResourceValue) {
@@ -421,13 +427,13 @@ public final class BridgeContext extends Activity {
// look for the value in the defStyle first (and its parent if needed)
if (defStyleValues != null) {
- resValue = mResourceResolver.findItemInStyle(defStyleValues, name);
+ resValue = mRenderResources.findItemInStyle(defStyleValues, name);
}
// if the item is not present in the defStyle, we look in the main theme (and
// its parent themes)
if (resValue == null) {
- resValue = mResourceResolver.findItemInTheme(name);
+ resValue = mRenderResources.findItemInTheme(name);
}
// if we found a value, we make sure this doesn't reference another value.
@@ -438,7 +444,7 @@ public final class BridgeContext extends Activity {
defaultPropMap.put(name, resValue.getValue());
}
- resValue = mResourceResolver.resolveResValue(resValue);
+ resValue = mRenderResources.resolveResValue(resValue);
}
ta.bridgeSetValue(index, name, resValue);
@@ -446,7 +452,7 @@ public final class BridgeContext extends Activity {
// there is a value in the XML, but we need to resolve it in case it's
// referencing another resource or a theme value.
ta.bridgeSetValue(index, name,
- mResourceResolver.resolveValue(null, name, value, isPlatformFile));
+ mRenderResources.resolveValue(null, name, value, isPlatformFile));
}
}
}
@@ -473,7 +479,7 @@ public final class BridgeContext extends Activity {
throws Resources.NotFoundException {
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, null);
- BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
+ BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
false /* platformResourceFlag */);
// loop through all the values in the style map, and init the TypedArray with
@@ -484,10 +490,10 @@ public final class BridgeContext extends Activity {
String name = styleAttribute.getValue();
// get the value from the style, or its parent styles.
- ResourceValue resValue = mResourceResolver.findItemInStyle(style, name);
+ ResourceValue resValue = mRenderResources.findItemInStyle(style, name);
// resolve it to make sure there are no references left.
- ta.bridgeSetValue(index, name, mResourceResolver.resolveResValue(resValue));
+ ta.bridgeSetValue(index, name, mRenderResources.resolveResValue(resValue));
}
ta.sealArray();
@@ -836,7 +842,7 @@ public final class BridgeContext extends Activity {
@Override
public ApplicationInfo getApplicationInfo() {
- return new ApplicationInfo();
+ return mApplicationInfo;
}
@Override
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
index 61f47ba7aa1e..7fa6fdf893dc 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java
@@ -18,8 +18,8 @@ package com.android.layoutlib.bridge.android;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
-import com.android.ide.common.resources.ResourceResolver;
import com.android.layoutlib.bridge.Bridge;
import org.kxml2.io.KXmlParser;
@@ -155,14 +155,14 @@ public final class BridgeInflater extends LayoutInflater {
String[] layoutInfo = Bridge.resolveResourceValue(resource);
if (layoutInfo != null) {
- value = bridgeContext.getResolver().getFrameworkResource(
- ResourceResolver.RES_LAYOUT, layoutInfo[0]);
+ value = bridgeContext.getRenderResources().getFrameworkResource(
+ RenderResources.RES_LAYOUT, layoutInfo[0]);
} else {
layoutInfo = mProjectCallback.resolveResourceValue(resource);
if (layoutInfo != null) {
- value = bridgeContext.getResolver().getProjectResource(
- ResourceResolver.RES_LAYOUT, layoutInfo[0]);
+ value = bridgeContext.getRenderResources().getProjectResource(
+ RenderResources.RES_LAYOUT, layoutInfo[0]);
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
index 3af6a1b5b92a..7b66809d3175 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
@@ -104,7 +104,8 @@ public final class BridgeResources extends Resources {
if (resourceInfo != null) {
platformResFlag_out[0] = true;
- return mContext.getResolver().getFrameworkResource(resourceInfo[1], resourceInfo[0]);
+ return mContext.getRenderResources().getFrameworkResource(
+ resourceInfo[1], resourceInfo[0]);
}
// didn't find a match in the framework? look in the project.
@@ -113,7 +114,8 @@ public final class BridgeResources extends Resources {
if (resourceInfo != null) {
platformResFlag_out[0] = false;
- return mContext.getResolver().getProjectResource(resourceInfo[1], resourceInfo[0]);
+ return mContext.getRenderResources().getProjectResource(
+ resourceInfo[1], resourceInfo[0]);
}
}
@@ -180,8 +182,8 @@ public final class BridgeResources extends Resources {
"Failed to configure parser for " + value, e, null /*data*/);
// we'll return null below.
} catch (Exception e) {
- // this is an error and not warning since the file existence is checked before
- // attempting to parse it.
+ // this is an error and not warning since the file existence is
+ // checked before attempting to parse it.
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_READ,
"Failed to parse file " + value, e, null /*data*/);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
index b166da552c44..8d3c929d6ec2 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
@@ -17,9 +17,9 @@
package com.android.layoutlib.bridge.android;
import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.rendering.api.StyleResourceValue;
-import com.android.ide.common.resources.ResourceResolver;
import com.android.internal.util.XmlUtils;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.BridgeConstants;
@@ -634,11 +634,11 @@ public final class BridgeTypedArray extends TypedArray {
// if this is a framework id
if (mPlatformFile || value.startsWith("@android") || value.startsWith("@+android")) {
// look for idName in the android R classes
- return mContext.getFrameworkResourceValue(ResourceResolver.RES_ID, idName, defValue);
+ return mContext.getFrameworkResourceValue(RenderResources.RES_ID, idName, defValue);
}
// look for idName in the project R class.
- return mContext.getProjectResourceValue(ResourceResolver.RES_ID, idName, defValue);
+ return mContext.getProjectResourceValue(RenderResources.RES_ID, idName, defValue);
}
// not a direct id valid reference? resolve it
@@ -683,7 +683,7 @@ public final class BridgeTypedArray extends TypedArray {
ResourceValue value = mResourceData[index];
String stringValue = value.getValue();
- if (stringValue == null || ResourceResolver.REFERENCE_NULL.equals(stringValue)) {
+ if (stringValue == null || RenderResources.REFERENCE_NULL.equals(stringValue)) {
return null;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java
index 45d8e2647e5f..4a6880b69002 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java
@@ -16,8 +16,8 @@
package com.android.layoutlib.bridge.android;
+import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
-import com.android.ide.common.resources.ResourceResolver;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.BridgeConstants;
@@ -58,7 +58,7 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes {
String ns = mParser.getAttributeNamespace(index);
if (BridgeConstants.NS_RESOURCES.equals(ns)) {
- Integer v = Bridge.getResourceValue(ResourceResolver.RES_ATTR, name);
+ Integer v = Bridge.getResourceValue(RenderResources.RES_ATTR, name);
if (v != null) {
return v.intValue();
}
@@ -69,7 +69,7 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes {
// this is not an attribute in the android namespace, we query the customviewloader, if
// the namespaces match.
if (mContext.getProjectCallback().getNamespace().equals(ns)) {
- Integer v = mContext.getProjectCallback().getResourceValue(ResourceResolver.RES_ATTR,
+ Integer v = mContext.getProjectCallback().getResourceValue(RenderResources.RES_ATTR,
name);
if (v != null) {
return v.intValue();
@@ -103,9 +103,9 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes {
private int resolveResourceValue(String value, int defaultValue) {
// now look for this particular value
- ResourceResolver resolver = mContext.getResolver();
- ResourceValue resource = resolver.resolveResValue(
- resolver.findResValue(value, mPlatformFile));
+ RenderResources resources = mContext.getRenderResources();
+ ResourceValue resource = resources.resolveResValue(
+ resources.findResValue(value, mPlatformFile));
if (resource != null) {
Integer id = null;
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index a227d0c36d6c..63d52e9638da 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -30,6 +30,7 @@ import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.ide.common.rendering.api.Params;
+import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.ResourceDensity;
import com.android.ide.common.rendering.api.ResourceValue;
@@ -37,9 +38,8 @@ import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.StyleResourceValue;
import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.common.rendering.api.Params.RenderingMode;
+import com.android.ide.common.rendering.api.RenderResources.FrameworkResourceIdProvider;
import com.android.ide.common.rendering.api.Result.Status;
-import com.android.ide.common.resources.ResourceResolver;
-import com.android.ide.common.resources.ResourceResolver.IFrameworkResourceIdProvider;
import com.android.internal.util.XmlUtils;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.android.BridgeContext;
@@ -67,8 +67,10 @@ import android.view.View.AttachInfo;
import android.view.View.MeasureSpec;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabWidget;
+import android.widget.TabHost.TabSpec;
import java.awt.Color;
import java.awt.Graphics2D;
@@ -87,7 +89,7 @@ import java.util.concurrent.locks.ReentrantLock;
* be done on the layout.
*
*/
-public class RenderSessionImpl {
+public class RenderSessionImpl extends FrameworkResourceIdProvider {
private static final int DEFAULT_TITLE_BAR_HEIGHT = 25;
private static final int DEFAULT_STATUS_BAR_HEIGHT = 25;
@@ -156,8 +158,6 @@ public class RenderSessionImpl {
return result;
}
- Bridge.setLog(mParams.getLog());
-
// setup the display Metrics.
DisplayMetrics metrics = new DisplayMetrics();
metrics.densityDpi = mParams.getDensity();
@@ -168,40 +168,24 @@ public class RenderSessionImpl {
metrics.xdpi = mParams.getXdpi();
metrics.ydpi = mParams.getYdpi();
- // create the resource resolver
- ResourceResolver resolver = ResourceResolver.create(
- new IFrameworkResourceIdProvider() {
- public Integer getId(String resType, String resName) {
- return Bridge.getResourceValue(resType, resName);
- }
- },
- mParams.getProjectResources(),
- mParams.getFrameworkResources(),
- mParams.getThemeName(),
- mParams.isProjectTheme(),
- mParams.getLog());
-
+ RenderResources resources = mParams.getResources();
// build the context
- mContext = new BridgeContext(mParams.getProjectKey(), metrics, resolver,
- mParams.getProjectCallback());
+ mContext = new BridgeContext(mParams.getProjectKey(), metrics, resources,
+ mParams.getProjectCallback(), mParams.getTargetSdkVersion());
- // set the current rendering context
- sCurrentContext = mContext;
- // make sure the Resources object references the context (and other objects) for this
- // scene
- mContext.initResources();
+ setUp();
// get the screen offset and window-background resource
mWindowBackground = null;
mScreenOffset = 0;
- StyleResourceValue theme = resolver.getTheme();
+ StyleResourceValue theme = resources.getTheme();
if (theme != null && mParams.isBgColorOverridden() == false) {
- mWindowBackground = resolver.findItemInTheme("windowBackground");
- mWindowBackground = resolver.resolveResValue(mWindowBackground);
+ mWindowBackground = resources.findItemInTheme("windowBackground");
+ mWindowBackground = resources.resolveResValue(mWindowBackground);
- mScreenOffset = getScreenOffset(resolver, metrics);
+ mScreenOffset = getScreenOffset(resources, metrics);
}
// build the inflater and parser.
@@ -249,11 +233,7 @@ public class RenderSessionImpl {
return result;
}
- // make sure the Resources object references the context (and other objects) for this
- // scene
- mContext.initResources();
- sCurrentContext = mContext;
- Bridge.setLog(mParams.getLog());
+ setUp();
return SUCCESS.createResult();
}
@@ -306,16 +286,45 @@ public class RenderSessionImpl {
// without a successful call to prepareScene. This test makes sure that unlock() will
// not throw IllegalMonitorStateException.
if (lock.isHeldByCurrentThread()) {
- // Make sure to remove static references, otherwise we could not unload the lib
- mContext.disposeResources();
- Bridge.setLog(null);
- sCurrentContext = null;
-
+ tearDown();
lock.unlock();
}
}
/**
+ * Sets up the session for rendering.
+ * <p/>
+ * The counterpart is {@link #tearDown()}.
+ */
+ private void setUp() {
+ // make sure the Resources object references the context (and other objects) for this
+ // scene
+ mContext.initResources();
+ sCurrentContext = mContext;
+
+ LayoutLog currentLog = mParams.getLog();
+ Bridge.setLog(currentLog);
+ mContext.getRenderResources().setFrameworkResourceIdProvider(this);
+ mContext.getRenderResources().setLogger(currentLog);
+ }
+
+ /**
+ * Tear down the session after rendering.
+ * <p/>
+ * The counterpart is {@link #setUp()}.
+ */
+ private void tearDown() {
+ // Make sure to remove static references, otherwise we could not unload the lib
+ mContext.disposeResources();
+ sCurrentContext = null;
+
+ Bridge.setLog(null);
+ mContext.getRenderResources().setFrameworkResourceIdProvider(null);
+ mContext.getRenderResources().setLogger(null);
+
+ }
+
+ /**
* Inflates the layout.
* <p>
* {@link #acquire(long)} must have been called before this.
@@ -502,18 +511,18 @@ public class RenderSessionImpl {
ResourceValue animationResource = null;
int animationId = 0;
if (isFrameworkAnimation) {
- animationResource = mContext.getResolver().getFrameworkResource(
- ResourceResolver.RES_ANIMATOR, animationName);
+ animationResource = mContext.getRenderResources().getFrameworkResource(
+ RenderResources.RES_ANIMATOR, animationName);
if (animationResource != null) {
- animationId = Bridge.getResourceValue(ResourceResolver.RES_ANIMATOR,
+ animationId = Bridge.getResourceValue(RenderResources.RES_ANIMATOR,
animationName);
}
} else {
- animationResource = mContext.getResolver().getProjectResource(
- ResourceResolver.RES_ANIMATOR, animationName);
+ animationResource = mContext.getRenderResources().getProjectResource(
+ RenderResources.RES_ANIMATOR, animationName);
if (animationResource != null) {
animationId = mContext.getProjectCallback().getResourceValue(
- ResourceResolver.RES_ANIMATOR, animationName);
+ RenderResources.RES_ANIMATOR, animationName);
}
}
@@ -911,11 +920,11 @@ public class RenderSessionImpl {
/**
* Returns the top screen offset. This depends on whether the current theme defines the user
* of the title and status bars.
- * @param resolver The {@link ResourceResolver}
+ * @param resolver The {@link RenderResources}
* @param metrics The display metrics
* @return the pixel height offset
*/
- private int getScreenOffset(ResourceResolver resolver, DisplayMetrics metrics) {
+ private int getScreenOffset(RenderResources resolver, DisplayMetrics metrics) {
int offset = 0;
// get the title bar flag from the current theme.
@@ -961,7 +970,7 @@ public class RenderSessionImpl {
int defaultOffset = DEFAULT_STATUS_BAR_HEIGHT;
// get the real value
- value = resolver.getFrameworkResource(ResourceResolver.RES_DIMEN, "status_bar_height");
+ value = resolver.getFrameworkResource(RenderResources.RES_DIMEN, "status_bar_height");
if (value != null) {
TypedValue typedValue = ResourceHelper.getValue(value.getValue());
if (typedValue != null) {
@@ -1040,28 +1049,36 @@ public class RenderSessionImpl {
// now process the content of the framelayout and dynamically create tabs for it.
final int count = content.getChildCount();
- if (count == 0) {
- throw new PostInflateException(
- "The FrameLayout for the TabHost has no content. Rendering failed.\n");
- }
-
// this must be called before addTab() so that the TabHost searches its TabWidget
// and FrameLayout.
tabHost.setup();
- // for each child of the framelayout, add a new TabSpec
- for (int i = 0 ; i < count ; i++) {
- View child = content.getChildAt(i);
- String tabSpec = String.format("tab_spec%d", i+1);
- int id = child.getId();
- String[] resource = projectCallback.resolveResourceValue(id);
- String name;
- if (resource != null) {
- name = resource[0]; // 0 is resource name, 1 is resource type.
- } else {
- name = String.format("Tab %d", i+1); // default name if id is unresolved.
+ if (count == 0) {
+ // Create a dummy child to get a single tab
+ TabSpec spec = tabHost.newTabSpec("tag").setIndicator("Tab Label",
+ tabHost.getResources().getDrawable(android.R.drawable.ic_menu_info_details))
+ .setContent(new TabHost.TabContentFactory() {
+ public View createTabContent(String tag) {
+ return new LinearLayout(mContext);
+ }
+ });
+ tabHost.addTab(spec);
+ return;
+ } else {
+ // for each child of the framelayout, add a new TabSpec
+ for (int i = 0 ; i < count ; i++) {
+ View child = content.getChildAt(i);
+ String tabSpec = String.format("tab_spec%d", i+1);
+ int id = child.getId();
+ String[] resource = projectCallback.resolveResourceValue(id);
+ String name;
+ if (resource != null) {
+ name = resource[0]; // 0 is resource name, 1 is resource type.
+ } else {
+ name = String.format("Tab %d", i+1); // default name if id is unresolved.
+ }
+ tabHost.addTab(tabHost.newTabSpec(tabSpec).setIndicator(name).setContent(id));
}
- tabHost.addTab(tabHost.newTabSpec(tabSpec).setIndicator(name).setContent(id));
}
}
@@ -1117,4 +1134,11 @@ public class RenderSessionImpl {
public RenderSession getSession() {
return mScene;
}
+
+ // --- FrameworkResourceIdProvider methods
+
+ @Override
+ public Integer getId(String resType, String resName) {
+ return Bridge.getResourceValue(resType, resName);
+ }
}
diff --git a/voip/java/com/android/server/sip/SipService.java b/voip/java/com/android/server/sip/SipService.java
index 3af6e78068b3..dc669896e35c 100644
--- a/voip/java/com/android/server/sip/SipService.java
+++ b/voip/java/com/android/server/sip/SipService.java
@@ -105,7 +105,7 @@ public final class SipService extends ISipService.Stub {
if (SipManager.isApiSupported(context)) {
ServiceManager.addService("sip", new SipService(context));
context.sendBroadcast(new Intent(SipManager.ACTION_SIP_SERVICE_UP));
- if (DEBUG) Log.i(TAG, "SIP service started");
+ if (DEBUG) Log.d(TAG, "SIP service started");
}
}
@@ -113,10 +113,6 @@ public final class SipService extends ISipService.Stub {
if (DEBUG) Log.d(TAG, " service started!");
mContext = context;
mConnectivityReceiver = new ConnectivityReceiver();
- context.registerReceiver(mConnectivityReceiver,
- new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
- context.registerReceiver(mWifiStateReceiver,
- new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
mMyWakeLock = new SipWakeLock((PowerManager)
context.getSystemService(Context.POWER_SERVICE));
@@ -124,7 +120,7 @@ public final class SipService extends ISipService.Stub {
mWifiOnly = SipManager.isSipWifiOnly(context);
}
- BroadcastReceiver mWifiStateReceiver = new BroadcastReceiver() {
+ private BroadcastReceiver mWifiStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
@@ -147,6 +143,20 @@ public final class SipService extends ISipService.Stub {
}
};
+ private void registerReceivers() {
+ mContext.registerReceiver(mConnectivityReceiver,
+ new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
+ mContext.registerReceiver(mWifiStateReceiver,
+ new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
+ if (DEBUG) Log.d(TAG, " +++ register receivers");
+ }
+
+ private void unregisterReceivers() {
+ mContext.unregisterReceiver(mConnectivityReceiver);
+ mContext.unregisterReceiver(mWifiStateReceiver);
+ if (DEBUG) Log.d(TAG, " --- unregister receivers");
+ }
+
private MyExecutor getExecutor() {
// create mExecutor lazily
if (mExecutor == null) mExecutor = new MyExecutor();
@@ -166,12 +176,14 @@ public final class SipService extends ISipService.Stub {
return profiles.toArray(new SipProfile[profiles.size()]);
}
- public void open(SipProfile localProfile) {
+ public synchronized void open(SipProfile localProfile) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.USE_SIP, null);
localProfile.setCallingUid(Binder.getCallingUid());
try {
+ boolean addingFirstProfile = mSipGroups.isEmpty();
createGroup(localProfile);
+ if (addingFirstProfile && !mSipGroups.isEmpty()) registerReceivers();
} catch (SipException e) {
Log.e(TAG, "openToMakeCalls()", e);
// TODO: how to send the exception back
@@ -192,8 +204,10 @@ public final class SipService extends ISipService.Stub {
if (DEBUG) Log.d(TAG, "open3: " + localProfile.getUriString() + ": "
+ incomingCallPendingIntent + ": " + listener);
try {
+ boolean addingFirstProfile = mSipGroups.isEmpty();
SipSessionGroupExt group = createGroup(localProfile,
incomingCallPendingIntent, listener);
+ if (addingFirstProfile && !mSipGroups.isEmpty()) registerReceivers();
if (localProfile.getAutoRegistration()) {
group.openToReceiveCalls();
if (mWifiEnabled) grabWifiLock();
@@ -235,6 +249,7 @@ public final class SipService extends ISipService.Stub {
releaseWifiLock();
mMyWakeLock.reset(); // in case there's leak
}
+ if (mSipGroups.isEmpty()) unregisterReceivers();
}
public synchronized boolean isOpened(String localProfileUri) {
@@ -1055,7 +1070,10 @@ public final class SipService extends ISipService.Stub {
// we want to skip the interim ones) but deliver bad news
// immediately
if (connected) {
- if (mTask != null) mTask.cancel();
+ if (mTask != null) {
+ mTask.cancel();
+ mMyWakeLock.release(mTask);
+ }
mTask = new MyTimerTask(type, connected);
mTimer.schedule(mTask, 2 * 1000L);
// hold wakup lock so that we can finish changes before the
@@ -1096,6 +1114,7 @@ public final class SipService extends ISipService.Stub {
if (mTask != this) {
Log.w(TAG, " unexpected task: " + mNetworkType
+ (mConnected ? " CONNECTED" : "DISCONNECTED"));
+ mMyWakeLock.release(this);
return;
}
mTask = null;