summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--api/16.txt2
-rw-r--r--api/current.txt20
-rw-r--r--cmds/bootanimation/BootAnimation.cpp2
-rw-r--r--core/java/android/app/ContextImpl.java6
-rw-r--r--core/java/android/app/DatePickerDialog.java4
-rw-r--r--core/java/android/app/TimePickerDialog.java4
-rwxr-xr-xcore/java/android/bluetooth/BluetoothA2dp.java1
-rwxr-xr-xcore/java/android/bluetooth/BluetoothDevice.java6
-rwxr-xr-xcore/java/android/bluetooth/BluetoothHeadset.java1
-rwxr-xr-x[-rw-r--r--]core/java/android/bluetooth/BluetoothProfile.java7
-rw-r--r--core/java/android/content/BroadcastReceiver.java2
-rw-r--r--core/java/android/content/ClipData.java2
-rw-r--r--core/java/android/content/Context.java9
-rw-r--r--core/java/android/content/pm/PackageManager.java2
-rw-r--r--core/java/android/hardware/display/DisplayManager.java77
-rw-r--r--core/java/android/hardware/display/IDisplayManager.aidl24
-rw-r--r--core/java/android/net/DummyDataStateTracker.java2
-rw-r--r--core/java/android/net/INetworkStatsService.aidl3
-rw-r--r--core/java/android/net/MobileDataStateTracker.java2
-rw-r--r--core/java/android/net/NetworkStateTracker.java6
-rw-r--r--core/java/android/net/TrafficStats.java28
-rw-r--r--core/java/android/nfc/NdefRecord.java2
-rw-r--r--core/java/android/os/BatteryStats.java8
-rw-r--r--core/java/android/os/LocalPowerManager.java6
-rw-r--r--core/java/android/os/PowerManager.java143
-rw-r--r--core/java/android/os/WorkSource.java14
-rw-r--r--core/java/android/os/storage/StorageManager.java2
-rw-r--r--core/java/android/preference/Preference.java7
-rw-r--r--core/java/android/preference/PreferenceActivity.java7
-rw-r--r--core/java/android/preference/PreferenceCategory.java7
-rw-r--r--core/java/android/preference/PreferenceFragment.java7
-rw-r--r--core/java/android/preference/PreferenceGroup.java7
-rw-r--r--core/java/android/preference/PreferenceManager.java36
-rw-r--r--core/java/android/preference/PreferenceScreen.java7
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java5
-rw-r--r--core/java/android/view/Display.java403
-rw-r--r--core/java/android/view/DisplayInfo.aidl19
-rw-r--r--core/java/android/view/DisplayInfo.java226
-rw-r--r--core/java/android/view/IWindowManager.aidl5
-rw-r--r--core/java/android/view/IWindowSession.aidl5
-rw-r--r--core/java/android/view/Surface.java27
-rw-r--r--core/java/android/view/SurfaceHolder.java6
-rw-r--r--core/java/android/view/SurfaceView.java4
-rw-r--r--core/java/android/view/View.java2
-rw-r--r--core/java/android/view/ViewConfiguration.java9
-rw-r--r--core/java/android/view/ViewGroup.java2
-rw-r--r--core/java/android/view/ViewRootImpl.java8
-rw-r--r--core/java/android/view/WindowManagerImpl.java12
-rw-r--r--core/java/android/view/textservice/TextServicesManager.java8
-rw-r--r--core/java/android/webkit/WebSettings.java16
-rw-r--r--core/java/android/webkit/WebView.java4
-rw-r--r--core/java/android/widget/AbsListView.java11
-rw-r--r--core/java/android/widget/AdapterViewAnimator.java6
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java5
-rw-r--r--core/java/android/widget/Button.java4
-rw-r--r--core/java/android/widget/CheckBox.java4
-rw-r--r--core/java/android/widget/CheckedTextView.java21
-rw-r--r--core/java/android/widget/DatePicker.java4
-rw-r--r--core/java/android/widget/EditText.java4
-rw-r--r--core/java/android/widget/GridView.java4
-rw-r--r--core/java/android/widget/ImageButton.java4
-rw-r--r--core/java/android/widget/LinearLayout.java4
-rw-r--r--core/java/android/widget/ListPopupWindow.java6
-rw-r--r--core/java/android/widget/ListView.java4
-rw-r--r--core/java/android/widget/RadioButton.java4
-rw-r--r--core/java/android/widget/RatingBar.java3
-rw-r--r--core/java/android/widget/RelativeLayout.java19
-rw-r--r--core/java/android/widget/RemoteViewsAdapter.java189
-rw-r--r--core/java/android/widget/SearchView.java21
-rw-r--r--core/java/android/widget/Spinner.java11
-rw-r--r--core/java/android/widget/Switch.java11
-rw-r--r--core/java/android/widget/TextView.java33
-rw-r--r--core/java/android/widget/TimePicker.java4
-rw-r--r--core/java/android/widget/ToggleButton.java4
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java11
-rw-r--r--core/jni/Android.mk1
-rw-r--r--core/jni/AndroidRuntime.cpp2
-rw-r--r--core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp2
-rw-r--r--core/jni/android_view_Display.cpp151
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp4
-rw-r--r--core/jni/android_view_Surface.cpp6
-rwxr-xr-xcore/res/res/values-mcc208-mnc01/config.xml38
-rwxr-xr-xcore/res/res/values-mcc214-mnc03/config.xml38
-rwxr-xr-xcore/res/res/values-mcc214-mnc07/config.xml38
-rwxr-xr-xcore/res/res/values-mcc222-mnc01/config.xml38
-rwxr-xr-xcore/res/res/values-mcc222-mnc10/config.xml38
-rwxr-xr-xcore/res/res/values-mcc234-mnc33/config.xml38
-rwxr-xr-xcore/res/res/values-mcc302-mnc370/config.xml38
-rwxr-xr-xcore/res/res/values-mcc302-mnc660/config.xml38
-rwxr-xr-xcore/res/res/values-mcc302-mnc720/config.xml38
-rwxr-xr-xcore/res/res/values-mcc340-mnc01/config.xml38
-rw-r--r--core/res/res/values-nl/strings.xml2
-rw-r--r--core/res/res/values-ru/strings.xml2
-rw-r--r--core/res/res/values-zu/strings.xml2
-rwxr-xr-xcore/res/res/values/config.xml5
-rw-r--r--core/res/res/values/themes.xml3
-rw-r--r--docs/html/distribute/googleplay/about/monetizing.jd2
-rw-r--r--docs/html/guide/components/fragments.jd6
-rw-r--r--docs/html/guide/google/gcm/gcm.jd27
-rw-r--r--docs/html/guide/google/gcm/index.jd2
-rw-r--r--docs/html/guide/guide_toc.cs3
-rw-r--r--docs/html/guide/topics/ui/controls/checkbox.jd2
-rw-r--r--docs/html/guide/topics/ui/declaring-layout.jd4
-rw-r--r--docs/html/guide/topics/ui/layout/gridview.jd2
-rw-r--r--docs/html/guide/topics/ui/settings.jd1171
-rw-r--r--docs/html/images/ui/settings/settings-headers-handset.pngbin0 -> 57277 bytes
-rw-r--r--docs/html/images/ui/settings/settings-headers-tablet.pngbin0 -> 52567 bytes
-rw-r--r--docs/html/images/ui/settings/settings-subscreen.pngbin0 -> 49541 bytes
-rw-r--r--docs/html/images/ui/settings/settings-titles.pngbin0 -> 66806 bytes
-rw-r--r--docs/html/images/ui/settings/settings.pngbin0 -> 96681 bytes
-rw-r--r--docs/html/shareables/README8
-rw-r--r--docs/html/shareables/app_widget_templates-v4.0.zipbin140221 -> 0 bytes
-rw-r--r--docs/html/shareables/icon_templates-v2.0.zipbin1175095 -> 0 bytes
-rw-r--r--docs/html/shareables/icon_templates-v2.3.zipbin1286803 -> 0 bytes
-rw-r--r--docs/html/shareables/icon_templates-v4.0.zipbin1616421 -> 0 bytes
-rw-r--r--docs/html/shareables/sample_images.zipbin254816 -> 0 bytes
-rw-r--r--docs/html/shareables/search_icons.zipbin9753 -> 0 bytes
-rw-r--r--docs/html/shareables/training/ActivityLifecycle.zipbin251212 -> 0 bytes
-rw-r--r--docs/html/shareables/training/BitmapFun.zipbin315657 -> 0 bytes
-rw-r--r--docs/html/shareables/training/CustomView.zipbin40248 -> 0 bytes
-rw-r--r--docs/html/shareables/training/DeviceManagement.zipbin19978 -> 0 bytes
-rw-r--r--docs/html/shareables/training/EffectiveNavigation.zipbin29897 -> 0 bytes
-rw-r--r--docs/html/shareables/training/FragmentBasics.zipbin283814 -> 0 bytes
-rw-r--r--docs/html/shareables/training/LocationAware.zipbin261408 -> 0 bytes
-rw-r--r--docs/html/shareables/training/MobileAds.zipbin42183 -> 0 bytes
-rw-r--r--docs/html/shareables/training/NetworkUsage.zipbin24270 -> 0 bytes
-rw-r--r--docs/html/shareables/training/NewsReader.zipbin334913 -> 0 bytes
-rw-r--r--docs/html/shareables/training/OpenGLES.zipbin27980 -> 0 bytes
-rw-r--r--docs/html/shareables/training/PhotoIntentActivity.zipbin15261 -> 0 bytes
-rw-r--r--docs/html/shareables/training/TabCompat.zipbin579116 -> 0 bytes
-rw-r--r--docs/html/tools/adk/adk.jd2
-rw-r--r--docs/html/training/cloudsync/aesync.jd432
-rw-r--r--docs/html/training/cloudsync/backupapi.jd5
-rw-r--r--docs/html/training/cloudsync/gcm.jd218
-rw-r--r--docs/html/training/cloudsync/index.jd15
-rw-r--r--docs/html/training/training_toc.cs8
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp8
-rw-r--r--include/androidfw/PowerManager.h8
-rw-r--r--libs/hwui/DisplayListRenderer.cpp12
-rw-r--r--libs/hwui/DisplayListRenderer.h4
-rw-r--r--libs/hwui/OpenGLRenderer.cpp4
-rw-r--r--libs/hwui/OpenGLRenderer.h2
-rw-r--r--media/java/android/media/AudioService.java38
-rw-r--r--media/java/android/media/MediaExtractor.java2
-rw-r--r--media/java/android/media/MediaPlayer.java2
-rw-r--r--media/libstagefright/codecs/aacdec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/aacdec/NOTICE202
-rw-r--r--media/libstagefright/codecs/aacenc/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/aacenc/NOTICE202
-rw-r--r--media/libstagefright/codecs/aacenc/SampleCode/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/aacenc/SampleCode/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrnb/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrnb/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrnb/common/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrnb/common/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrnb/dec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrnb/dec/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrnb/enc/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrnb/enc/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrwb/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrwb/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrwbenc/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrwbenc/NOTICE202
-rw-r--r--media/libstagefright/codecs/amrwbenc/SampleCode/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/amrwbenc/SampleCode/NOTICE202
-rw-r--r--media/libstagefright/codecs/avc/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/avc/NOTICE202
-rw-r--r--media/libstagefright/codecs/avc/common/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/avc/common/NOTICE202
-rw-r--r--media/libstagefright/codecs/avc/enc/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/avc/enc/NOTICE202
-rw-r--r--media/libstagefright/codecs/common/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/common/NOTICE202
-rw-r--r--media/libstagefright/codecs/g711/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/g711/NOTICE202
-rw-r--r--media/libstagefright/codecs/g711/dec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/g711/dec/NOTICE202
-rw-r--r--media/libstagefright/codecs/m4v_h263/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/m4v_h263/NOTICE202
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/NOTICE202
-rw-r--r--media/libstagefright/codecs/m4v_h263/enc/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/m4v_h263/enc/NOTICE202
-rw-r--r--media/libstagefright/codecs/mp3dec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/mp3dec/NOTICE202
-rw-r--r--media/libstagefright/codecs/on2/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/on2/NOTICE202
-rw-r--r--media/libstagefright/codecs/on2/dec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/on2/dec/NOTICE202
-rw-r--r--media/libstagefright/codecs/vorbis/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/vorbis/NOTICE202
-rw-r--r--media/libstagefright/codecs/vorbis/dec/MODULE_LICENSE_APACHE20
-rw-r--r--media/libstagefright/codecs/vorbis/dec/NOTICE202
-rw-r--r--packages/SystemUI/AndroidManifest.xml20
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded.xml20
-rw-r--r--packages/SystemUI/res/values/styles.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java78
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java27
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java15
-rw-r--r--services/input/InputDispatcher.cpp6
-rw-r--r--services/java/com/android/server/AppWidgetServiceImpl.java9
-rw-r--r--services/java/com/android/server/ConnectivityService.java95
-rw-r--r--services/java/com/android/server/SystemServer.java11
-rw-r--r--services/java/com/android/server/TelephonyRegistry.java9
-rw-r--r--services/java/com/android/server/WifiService.java10
-rw-r--r--services/java/com/android/server/display/DisplayAdapter.java35
-rw-r--r--services/java/com/android/server/display/DisplayDevice.java25
-rw-r--r--services/java/com/android/server/display/DisplayDeviceInfo.java54
-rw-r--r--services/java/com/android/server/display/DisplayManagerService.java155
-rw-r--r--services/java/com/android/server/display/HeadlessDisplayAdapter.java44
-rw-r--r--services/java/com/android/server/display/SurfaceFlingerDisplayAdapter.java41
-rw-r--r--services/java/com/android/server/net/NetworkStatsService.java8
-rw-r--r--services/java/com/android/server/power/PowerManagerService.java21
-rw-r--r--services/java/com/android/server/wm/BlackFrame.java9
-rw-r--r--services/java/com/android/server/wm/DimAnimator.java6
-rw-r--r--services/java/com/android/server/wm/DimSurface.java6
-rw-r--r--services/java/com/android/server/wm/DragState.java4
-rw-r--r--services/java/com/android/server/wm/ScreenRotationAnimation.java7
-rw-r--r--services/java/com/android/server/wm/Session.java27
-rw-r--r--services/java/com/android/server/wm/StrictModeFlash.java3
-rw-r--r--services/java/com/android/server/wm/Watermark.java3
-rw-r--r--services/java/com/android/server/wm/WindowAnimator.java6
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java280
-rw-r--r--services/java/com/android/server/wm/WindowState.java7
-rw-r--r--services/java/com/android/server/wm/WindowStateAnimator.java22
-rw-r--r--services/jni/Android.mk1
-rw-r--r--services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp90
-rw-r--r--services/jni/com_android_server_input_InputManagerService.cpp2
-rw-r--r--services/jni/com_android_server_power_PowerManagerService.cpp6
-rw-r--r--services/jni/onload.cpp2
-rw-r--r--telephony/java/android/telephony/CellIdentity.java85
-rw-r--r--telephony/java/android/telephony/CellIdentityCdma.java (renamed from telephony/java/android/telephony/CdmaCellIdentity.java)131
-rw-r--r--telephony/java/android/telephony/CellIdentityGsm.java (renamed from telephony/java/android/telephony/GsmCellIdentity.java)126
-rw-r--r--telephony/java/android/telephony/CellIdentityLte.java217
-rw-r--r--telephony/java/android/telephony/CellInfo.java245
-rw-r--r--telephony/java/android/telephony/CellInfoCdma.java152
-rw-r--r--telephony/java/android/telephony/CellInfoGsm.java150
-rw-r--r--telephony/java/android/telephony/CellInfoLte.java152
-rw-r--r--telephony/java/android/telephony/CellSignalStrength.java120
-rw-r--r--telephony/java/android/telephony/CellSignalStrengthCdma.java402
-rw-r--r--telephony/java/android/telephony/CellSignalStrengthGsm.java251
-rw-r--r--telephony/java/android/telephony/CellSignalStrengthLte.java299
-rw-r--r--telephony/java/android/telephony/LteCellIdentity.java142
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java25
-rw-r--r--telephony/java/android/telephony/SignalStrength.java86
-rwxr-xr-xtelephony/java/android/telephony/TelephonyManager.java2
-rw-r--r--telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java18
-rw-r--r--telephony/java/android/telephony/cdma/CdmaSmsCbProgramResults.java144
-rw-r--r--telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl2
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl2
-rw-r--r--test-runner/src/android/test/MoreAsserts.java2
-rw-r--r--test-runner/src/android/test/ProviderTestCase2.java2
-rw-r--r--test-runner/src/android/test/ServiceTestCase.java2
-rw-r--r--tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java2
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java106
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java18
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java124
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh63
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs21
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs22
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh62
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs21
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs22
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java186
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs13
-rw-r--r--tools/layoutlib/bridge/src/android/view/Display_Delegate.java53
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java18
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java19
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java2
272 files changed, 6762 insertions, 6973 deletions
diff --git a/Android.mk b/Android.mk
index 5fb66ab512ae..61e8a77dc969 100644
--- a/Android.mk
+++ b/Android.mk
@@ -114,6 +114,7 @@ LOCAL_SRC_FILES += \
core/java/android/content/pm/IPackageStatsObserver.aidl \
core/java/android/database/IContentObserver.aidl \
core/java/android/hardware/ISerialManager.aidl \
+ core/java/android/hardware/display/IDisplayManager.aidl \
core/java/android/hardware/input/IInputManager.aidl \
core/java/android/hardware/input/IInputDevicesChangedListener.aidl \
core/java/android/hardware/usb/IUsbManager.aidl \
diff --git a/api/16.txt b/api/16.txt
index 85464ceac46b..984b844c1e6d 100644
--- a/api/16.txt
+++ b/api/16.txt
@@ -22892,7 +22892,7 @@ package android.view {
method protected void onApplyThemeResource(android.content.res.Resources.Theme, int, boolean);
}
- public class Display {
+ public final class Display {
method public void getCurrentSizeRange(android.graphics.Point, android.graphics.Point);
method public int getDisplayId();
method public deprecated int getHeight();
diff --git a/api/current.txt b/api/current.txt
index 2716d5bf77fc..86e47d699080 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5355,6 +5355,7 @@ package android.content {
field public static final int CONTEXT_INCLUDE_CODE = 1; // 0x1
field public static final int CONTEXT_RESTRICTED = 4; // 0x4
field public static final java.lang.String DEVICE_POLICY_SERVICE = "device_policy";
+ field public static final java.lang.String DISPLAY_SERVICE = "display";
field public static final java.lang.String DOWNLOAD_SERVICE = "download";
field public static final java.lang.String DROPBOX_SERVICE = "dropbox";
field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method";
@@ -9952,6 +9953,13 @@ package android.hardware {
}
+package android.hardware.display {
+
+ public final class DisplayManager {
+ }
+
+}
+
package android.hardware.input {
public final class InputManager {
@@ -16200,11 +16208,11 @@ package android.os {
method public void reboot(java.lang.String);
method public void userActivity(long, boolean);
field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000
- field public static final int FULL_WAKE_LOCK = 26; // 0x1a
+ field public static final deprecated int FULL_WAKE_LOCK = 26; // 0x1a
field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000
field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
field public static final deprecated int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
- field public static final int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
+ field public static final deprecated int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
}
public final class PowerManager.WakeLock {
@@ -23120,13 +23128,15 @@ package android.view {
method protected void onApplyThemeResource(android.content.res.Resources.Theme, int, boolean);
}
- public class Display {
+ public final class Display {
method public void getCurrentSizeRange(android.graphics.Point, android.graphics.Point);
method public int getDisplayId();
method public deprecated int getHeight();
method public void getMetrics(android.util.DisplayMetrics);
method public deprecated int getOrientation();
- method public int getPixelFormat();
+ method public deprecated int getPixelFormat();
+ method public void getRealMetrics(android.util.DisplayMetrics);
+ method public void getRealSize(android.graphics.Point);
method public void getRectSize(android.graphics.Rect);
method public float getRefreshRate();
method public int getRotation();
@@ -28059,6 +28069,7 @@ package android.widget {
method public void setHeight(int);
method public void setHorizontalOffset(int);
method public void setInputMethodMode(int);
+ method public void setLayoutDirection(int);
method public void setListSelector(android.graphics.drawable.Drawable);
method public void setModal(boolean);
method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
@@ -28442,6 +28453,7 @@ package android.widget {
method public void addRule(int, int);
method public java.lang.String debug(java.lang.String);
method public int[] getRules();
+ method public void removeRule(int);
field public boolean alignWithParent;
}
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 6b50486074df..2471a2e719f3 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -217,7 +217,7 @@ status_t BootAnimation::readyToRun() {
mAssets.addDefaultAssets();
DisplayInfo dinfo;
- status_t status = session()->getDisplayInfo(0, &dinfo);
+ status_t status = SurfaceComposerClient::getDisplayInfo(0, &dinfo);
if (status)
return -1;
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index f3f9b64d19c4..74fce628d72c 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -47,6 +47,7 @@ import android.hardware.ISerialManager;
import android.hardware.SensorManager;
import android.hardware.SerialManager;
import android.hardware.SystemSensorManager;
+import android.hardware.display.DisplayManager;
import android.hardware.input.IInputManager;
import android.hardware.input.InputManager;
import android.hardware.usb.IUsbManager;
@@ -343,6 +344,11 @@ class ContextImpl extends Context {
return InputManager.getInstance();
}});
+ registerService(DISPLAY_SERVICE, new StaticServiceFetcher() {
+ public Object createStaticService() {
+ return DisplayManager.getInstance();
+ }});
+
registerService(INPUT_METHOD_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
return InputMethodManager.getInstance(ctx);
diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java
index 3f0b4d4add92..d1688004e52d 100644
--- a/core/java/android/app/DatePickerDialog.java
+++ b/core/java/android/app/DatePickerDialog.java
@@ -33,8 +33,8 @@ import java.util.Calendar;
/**
* A simple dialog containing an {@link android.widget.DatePicker}.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-datepicker.html">Date Picker
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.</p>
*/
public class DatePickerDialog extends AlertDialog implements OnClickListener,
OnDateChangedListener {
diff --git a/core/java/android/app/TimePickerDialog.java b/core/java/android/app/TimePickerDialog.java
index d773bc8a444d..952227fe0c5e 100644
--- a/core/java/android/app/TimePickerDialog.java
+++ b/core/java/android/app/TimePickerDialog.java
@@ -30,8 +30,8 @@ import android.widget.TimePicker.OnTimeChangedListener;
/**
* A dialog that prompts the user for the time of day using a {@link TimePicker}.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-timepicker.html">Time Picker
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.</p>
*/
public class TimePickerDialog extends AlertDialog
implements OnClickListener, OnTimeChangedListener {
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 74f634b19a58..1b415e5eb9b6 100755
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -338,6 +338,7 @@ public final class BluetoothA2dp implements BluetoothProfile {
&& isValidDevice(device)) {
if (priority != BluetoothProfile.PRIORITY_OFF &&
priority != BluetoothProfile.PRIORITY_ON &&
+ priority != BluetoothProfile.PRIORITY_UNDEFINED &&
priority != BluetoothProfile.PRIORITY_AUTO_CONNECT) {
return false;
}
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 25047632ce37..4cc22b4ae909 100755
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -786,6 +786,12 @@ public final class BluetoothDevice implements Parcelable {
try {
return sService.getBondState(this);
} catch (RemoteException e) {Log.e(TAG, "", e);}
+ catch (NullPointerException npe) {
+ // Handle case where bluetooth service proxy
+ // is already null.
+ Log.e(TAG, "NullPointerException for getBondState() of device ("+
+ getAddress()+")", npe);
+ }
return BOND_NONE;
}
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 75dfe9dbb4cd..8e6ebafda50f 100755
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -456,6 +456,7 @@ public final class BluetoothHeadset implements BluetoothProfile {
isValidDevice(device)) {
if (priority != BluetoothProfile.PRIORITY_OFF &&
priority != BluetoothProfile.PRIORITY_ON &&
+ priority != BluetoothProfile.PRIORITY_UNDEFINED &&
priority != BluetoothProfile.PRIORITY_AUTO_CONNECT) {
return false;
}
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index 1920efa52f87..eada27c7b0d4 100644..100755
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
@@ -115,6 +115,13 @@ public interface BluetoothProfile {
public static final int PRIORITY_UNDEFINED = -1;
/**
+ * This Intent is sent to initiate the other profile connections which are enabled
+ * @hide
+ **/
+ public static final String ACTION_CONNECT_OTHER_PROFILES =
+ "android.bluetooth.profile.CONNECT_OTHER_PROFILES";
+
+ /**
* Get connected devices for this specific profile.
*
* <p> Return the set of devices which are in state {@link #STATE_CONNECTED}
diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java
index 9ddb2a6f7bd6..446f1af41177 100644
--- a/core/java/android/content/BroadcastReceiver.java
+++ b/core/java/android/content/BroadcastReceiver.java
@@ -735,7 +735,7 @@ public abstract class BroadcastReceiver {
/**
* Control inclusion of debugging help for mismatched
- * calls to {@ Context#registerReceiver(BroadcastReceiver, IntentFilter)
+ * calls to {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
* Context.registerReceiver()}.
* If called with true, before given to registerReceiver(), then the
* callstack of the following {@link Context#unregisterReceiver(BroadcastReceiver)
diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java
index 186683091817..88f1a3d5b4fd 100644
--- a/core/java/android/content/ClipData.java
+++ b/core/java/android/content/ClipData.java
@@ -563,7 +563,7 @@ public class ClipData implements Parcelable {
private String uriToHtml(String uri) {
StringBuilder builder = new StringBuilder(256);
builder.append("<a href=\"");
- builder.append(uri);
+ builder.append(Html.escapeHtml(uri));
builder.append("\">");
builder.append(Html.escapeHtml(uri));
builder.append("</a>");
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 490165d77023..8597993ffecf 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -1955,6 +1955,15 @@ public abstract class Context {
/**
* Use with {@link #getSystemService} to retrieve a
+ * {@link android.hardware.display.DisplayManager} for interacting with display devices.
+ *
+ * @see #getSystemService
+ * @see android.hardware.display.DisplayManager
+ */
+ public static final String DISPLAY_SERVICE = "display";
+
+ /**
+ * Use with {@link #getSystemService} to retrieve a
* {@link android.os.SchedulingPolicyService} for managing scheduling policy.
*
* @see #getSystemService
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index f9f7e2d42351..cd7ef0e8160e 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1610,7 +1610,7 @@ public abstract class PackageManager {
*
* @param flags Additional option flags. Use any combination of
* {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
- * {link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
+ * {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
*
* @return A List of ApplicationInfo objects, one for each application that
* is installed on the device. In the unlikely case of there being
diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java
new file mode 100644
index 000000000000..640044bfadc3
--- /dev/null
+++ b/core/java/android/hardware/display/DisplayManager.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.display;
+
+import android.content.Context;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
+import android.view.DisplayInfo;
+
+/**
+ * Manages the properties, media routing and power state of attached displays.
+ * <p>
+ * Get an instance of this class by calling
+ * {@link android.content.Context#getSystemService(java.lang.String)
+ * Context.getSystemService()} with the argument
+ * {@link android.content.Context#DISPLAY_SERVICE}.
+ * </p>
+ */
+public final class DisplayManager {
+ private static final String TAG = "DisplayManager";
+
+ private static DisplayManager sInstance;
+
+ private final IDisplayManager mDm;
+
+ private DisplayManager(IDisplayManager dm) {
+ mDm = dm;
+ }
+
+ /**
+ * Gets an instance of the display manager.
+ * @return The display manager instance.
+ * @hide
+ */
+ public static DisplayManager getInstance() {
+ synchronized (DisplayManager.class) {
+ if (sInstance == null) {
+ IBinder b = ServiceManager.getService(Context.DISPLAY_SERVICE);
+ sInstance = new DisplayManager(IDisplayManager.Stub.asInterface(b));
+ }
+ return sInstance;
+ }
+ }
+
+ /**
+ * Get information about a particular logical display.
+ *
+ * @param displayId The logical display id.
+ * @param outInfo A structure to populate with the display info.
+ * @return True if the logical display exists, false otherwise.
+ * @hide
+ */
+ public boolean getDisplayInfo(int displayId, DisplayInfo outInfo) {
+ try {
+ return mDm.getDisplayInfo(displayId, outInfo);
+ } catch (RemoteException ex) {
+ Log.e(TAG, "Could not get display information from display manager.", ex);
+ return false;
+ }
+ }
+}
diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl
new file mode 100644
index 000000000000..fd8c35f8d614
--- /dev/null
+++ b/core/java/android/hardware/display/IDisplayManager.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.display;
+
+import android.view.DisplayInfo;
+
+/** @hide */
+interface IDisplayManager {
+ boolean getDisplayInfo(int displayId, out DisplayInfo outInfo);
+}
diff --git a/core/java/android/net/DummyDataStateTracker.java b/core/java/android/net/DummyDataStateTracker.java
index 9f0f9cd3f522..ccd96ff3c0c1 100644
--- a/core/java/android/net/DummyDataStateTracker.java
+++ b/core/java/android/net/DummyDataStateTracker.java
@@ -123,7 +123,7 @@ public class DummyDataStateTracker implements NetworkStateTracker {
* Record the detailed state of a network, and if it is a
* change from the previous state, send a notification to
* any listeners.
- * @param state the new @{code DetailedState}
+ * @param state the new {@code DetailedState}
* @param reason a {@code String} indicating a reason for the state change,
* if one was supplied. May be {@code null}.
* @param extraInfo optional {@code String} providing extra information about the state change
diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl
index b7b87318554c..4d46334fb33e 100644
--- a/core/java/android/net/INetworkStatsService.aidl
+++ b/core/java/android/net/INetworkStatsService.aidl
@@ -45,4 +45,7 @@ interface INetworkStatsService {
/** Advise persistance threshold; may be overridden internally. */
void advisePersistThreshold(long thresholdBytes);
+ /** Adjust recorded network stats. */
+ void adjustNetworkStats(int uid, int tag, long rxBytes, long rxPackets, long txBytes, long txPackets, long operationCount);
+
}
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index 561294376335..1a9cff5748d0 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -373,7 +373,7 @@ public class MobileDataStateTracker implements NetworkStateTracker {
* Record the detailed state of a network, and if it is a
* change from the previous state, send a notification to
* any listeners.
- * @param state the new @{code DetailedState}
+ * @param state the new {@code DetailedState}
* @param reason a {@code String} indicating a reason for the state change,
* if one was supplied. May be {@code null}.
* @param extraInfo optional {@code String} providing extra information about the state change
diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java
index 7df0193c8b1e..313c1744db29 100644
--- a/core/java/android/net/NetworkStateTracker.java
+++ b/core/java/android/net/NetworkStateTracker.java
@@ -41,12 +41,6 @@ public interface NetworkStateTracker {
* -------------------------------------------------------------
*/
- // Share the event space with ConnectivityService (which we can't see, but
- // must send events to). If you change these, change ConnectivityService
- // too.
- static final int MIN_NETWORK_STATE_TRACKER_EVENT = 1;
- static final int MAX_NETWORK_STATE_TRACKER_EVENT = 100;
-
/**
* The network state has changed and the NetworkInfo object
* contains the new state.
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java
index e437d2e3475b..b66c2fe5cf8d 100644
--- a/core/java/android/net/TrafficStats.java
+++ b/core/java/android/net/TrafficStats.java
@@ -88,6 +88,13 @@ public class TrafficStats {
*/
public static final int TAG_SYSTEM_BACKUP = 0xFFFFFF03;
+ /**
+ * Default tag value for cloud messaging traffic.
+ *
+ * @hide
+ */
+ public static final int TAG_SYSTEM_CLOUD_MESSAGING = 0xFFFFFF04;
+
private static INetworkStatsService sStatsService;
private synchronized static INetworkStatsService getStatsService() {
@@ -246,6 +253,27 @@ public class TrafficStats {
}
}
+ /**
+ * Adjust network statistics for the given UID and tag by the requested
+ * amount. This can be used to correctly account network usage performed on
+ * behalf of another application. Values can be negative.
+ * <p>
+ * Requires that caller holds
+ * {@link android.Manifest.permission#MODIFY_NETWORK_ACCOUNTING} permission.
+ *
+ * @see #setThreadStatsUid(int)
+ * @hide
+ */
+ public static void adjustNetworkStats(int uid, int tag, long rxBytes, long rxPackets,
+ long txBytes, long txPackets, long operationCount) {
+ try {
+ getStatsService().adjustNetworkStats(
+ uid, tag, rxBytes, rxPackets, txBytes, txPackets, operationCount);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
/** {@hide} */
public static void closeQuietly(INetworkStatsSession session) {
// TODO: move to NetworkStatsService once it exists
diff --git a/core/java/android/nfc/NdefRecord.java b/core/java/android/nfc/NdefRecord.java
index 887233523ca4..ed1c5b3e0f6b 100644
--- a/core/java/android/nfc/NdefRecord.java
+++ b/core/java/android/nfc/NdefRecord.java
@@ -70,7 +70,7 @@ import java.util.Locale;
* indicate location with an NDEF message, provide support for chunking of
* NDEF records, and to pack optional fields. This class does not expose
* those details. To write an NDEF Record as binary you must first put it
- * into an @{link NdefMessage}, then call {@link NdefMessage#toByteArray()}.
+ * into an {@link NdefMessage}, then call {@link NdefMessage#toByteArray()}.
* <p class="note">
* {@link NdefMessage} and {@link NdefRecord} implementations are
* always available, even on Android devices that do not have NFC hardware.
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 2aa6fb5d2250..1bb27bdbcb9f 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -277,13 +277,15 @@ public abstract class BatteryStats implements Parcelable {
public abstract long getVideoTurnedOnTime(long batteryRealtime, int which);
/**
- * Note that these must match the constants in android.os.LocalPowerManager.
+ * Note that these must match the constants in android.os.PowerManager.
+ * Also, if the user activity types change, the BatteryStatsImpl.VERSION must
+ * also be bumped.
*/
static final String[] USER_ACTIVITY_TYPES = {
- "other", "cheek", "touch", "long_touch", "touch_up", "button", "unknown"
+ "other", "button", "touch"
};
- public static final int NUM_USER_ACTIVITY_TYPES = 7;
+ public static final int NUM_USER_ACTIVITY_TYPES = 3;
public abstract void noteUserActivityLocked(int type);
public abstract boolean hasUserActivity();
diff --git a/core/java/android/os/LocalPowerManager.java b/core/java/android/os/LocalPowerManager.java
index 52df1f8f91df..09336c78a4b2 100644
--- a/core/java/android/os/LocalPowerManager.java
+++ b/core/java/android/os/LocalPowerManager.java
@@ -18,12 +18,6 @@ package android.os;
/** @hide */
public interface LocalPowerManager {
- // Note: be sure to update BatteryStats if adding or modifying event constants.
-
- public static final int OTHER_EVENT = 0;
- public static final int BUTTON_EVENT = 1;
- public static final int TOUCH_EVENT = 2;
-
public static final int POKE_LOCK_IGNORE_TOUCH_EVENTS = 0x1;
public static final int POKE_LOCK_SHORT_TIMEOUT = 0x2;
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index b6e606c50bae..a75730379346 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -107,48 +107,47 @@ import android.util.Log;
public final class PowerManager {
private static final String TAG = "PowerManager";
- /*
- * These internal values define the underlying power elements that we might
- * want to control individually. Eventually we'd like to expose them.
+ /* NOTE: Wake lock levels were previously defined as a bit field, except that only a few
+ * combinations were actually supported so the bit field was removed. This explains
+ * why the numbering scheme is so odd. If adding a new wake lock level, any unused
+ * value can be used.
*/
- private static final int WAKE_BIT_CPU_STRONG = 1 << 0;
- private static final int WAKE_BIT_CPU_WEAK = 1 << 1;
- private static final int WAKE_BIT_SCREEN_DIM = 1 << 2;
- private static final int WAKE_BIT_SCREEN_BRIGHT = 1 << 3;
- private static final int WAKE_BIT_KEYBOARD_BRIGHT = 1 << 4;
- private static final int WAKE_BIT_PROXIMITY_SCREEN_OFF = 1 << 5;
-
- private static final int LOCK_MASK = WAKE_BIT_CPU_STRONG
- | WAKE_BIT_CPU_WEAK
- | WAKE_BIT_SCREEN_DIM
- | WAKE_BIT_SCREEN_BRIGHT
- | WAKE_BIT_KEYBOARD_BRIGHT
- | WAKE_BIT_PROXIMITY_SCREEN_OFF;
/**
* Wake lock level: Ensures that the CPU is running; the screen and keyboard
* backlight will be allowed to go off.
+ * <p>
+ * If the user presses the power button, then the screen will be turned off
+ * but the CPU will be kept on until all partial wake locks have been released.
+ * </p>
*/
- public static final int PARTIAL_WAKE_LOCK = WAKE_BIT_CPU_STRONG;
+ public static final int PARTIAL_WAKE_LOCK = 0x00000001;
/**
- * Wake lock level: Ensures that the screen and keyboard backlight are on at
- * full brightness.
+ * Wake lock level: Ensures that the screen is on (but may be dimmed);
+ * the keyboard backlight will be allowed to go off.
+ * <p>
+ * If the user presses the power button, then the {@link #SCREEN_DIM_WAKE_LOCK} will be
+ * implicitly released by the system, causing both the screen and the CPU to be turned off.
+ * Contrast with {@link #PARTIAL_WAKE_LOCK}.
+ * </p>
*
- * <p class="note">
- * Most applications should strongly consider using
+ * @deprecated Most applications should use
* {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead
- * of managing their own wake locks. This window flag will be correctly managed
- * by the platform as the user moves between applications and doesn't require
- * a special permission.
- * </p>
+ * of this type of wake lock, as it will be correctly managed by the platform
+ * as the user moves between applications and doesn't require a special permission.
*/
- public static final int FULL_WAKE_LOCK = WAKE_BIT_CPU_WEAK | WAKE_BIT_SCREEN_BRIGHT
- | WAKE_BIT_KEYBOARD_BRIGHT;
+ @Deprecated
+ public static final int SCREEN_DIM_WAKE_LOCK = 0x00000006;
/**
* Wake lock level: Ensures that the screen is on at full brightness;
* the keyboard backlight will be allowed to go off.
+ * <p>
+ * If the user presses the power button, then the {@link #SCREEN_BRIGHT_WAKE_LOCK} will be
+ * implicitly released by the system, causing both the screen and the CPU to be turned off.
+ * Contrast with {@link #PARTIAL_WAKE_LOCK}.
+ * </p>
*
* @deprecated Most applications should use
* {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead
@@ -156,33 +155,42 @@ public final class PowerManager {
* as the user moves between applications and doesn't require a special permission.
*/
@Deprecated
- public static final int SCREEN_BRIGHT_WAKE_LOCK = WAKE_BIT_CPU_WEAK | WAKE_BIT_SCREEN_BRIGHT;
+ public static final int SCREEN_BRIGHT_WAKE_LOCK = 0x0000000a;
/**
- * Wake lock level: Ensures that the screen is on (but may be dimmed);
- * the keyboard backlight will be allowed to go off.
+ * Wake lock level: Ensures that the screen and keyboard backlight are on at
+ * full brightness.
+ * <p>
+ * If the user presses the power button, then the {@link #FULL_WAKE_LOCK} will be
+ * implicitly released by the system, causing both the screen and the CPU to be turned off.
+ * Contrast with {@link #PARTIAL_WAKE_LOCK}.
+ * </p>
+ *
+ * @deprecated Most applications should use
+ * {@link android.view.WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON} instead
+ * of this type of wake lock, as it will be correctly managed by the platform
+ * as the user moves between applications and doesn't require a special permission.
*/
- public static final int SCREEN_DIM_WAKE_LOCK = WAKE_BIT_CPU_WEAK | WAKE_BIT_SCREEN_DIM;
+ @Deprecated
+ public static final int FULL_WAKE_LOCK = 0x0000001a;
/**
* Wake lock level: Turns the screen off when the proximity sensor activates.
* <p>
- * Since not all devices have proximity sensors, use {@link #getSupportedWakeLockFlags()}
+ * Since not all devices have proximity sensors, use {@link #getSupportedWakeLockFlags}
* to determine whether this wake lock level is supported.
* </p>
*
* {@hide}
*/
- public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = WAKE_BIT_PROXIMITY_SCREEN_OFF;
+ public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 0x00000020;
/**
- * Flag for {@link WakeLock#release release(int)} to defer releasing a
- * {@link #WAKE_BIT_PROXIMITY_SCREEN_OFF} wake lock until the proximity sensor returns
- * a negative value.
+ * Mask for the wake lock level component of a combined wake lock level and flags integer.
*
- * {@hide}
+ * @hide
*/
- public static final int WAIT_FOR_PROXIMITY_NEGATIVE = 1;
+ public static final int WAKE_LOCK_LEVEL_MASK = 0x0000ffff;
/**
* Wake lock flag: Turn the screen on when the wake lock is acquired.
@@ -195,7 +203,7 @@ public final class PowerManager {
* Cannot be used with {@link #PARTIAL_WAKE_LOCK}.
* </p>
*/
- public static final int ACQUIRE_CAUSES_WAKEUP = 1 << 28;
+ public static final int ACQUIRE_CAUSES_WAKEUP = 0x10000000;
/**
* Wake lock flag: When this wake lock is released, poke the user activity timer
@@ -207,7 +215,16 @@ public final class PowerManager {
* Cannot be used with {@link #PARTIAL_WAKE_LOCK}.
* </p>
*/
- public static final int ON_AFTER_RELEASE = 1 << 29;
+ public static final int ON_AFTER_RELEASE = 0x20000000;
+
+ /**
+ * Flag for {@link WakeLock#release release(int)} to defer releasing a
+ * {@link #WAKE_BIT_PROXIMITY_SCREEN_OFF} wake lock until the proximity sensor returns
+ * a negative value.
+ *
+ * {@hide}
+ */
+ public static final int WAIT_FOR_PROXIMITY_NEGATIVE = 1;
/**
* Brightness value to use when battery is low.
@@ -233,6 +250,27 @@ public final class PowerManager {
*/
public static final int BRIGHTNESS_OFF = 0;
+ // Note: Be sure to update android.os.BatteryStats and PowerManager.h
+ // if adding or modifying user activity event constants.
+
+ /**
+ * User activity event type: Unspecified event type.
+ * @hide
+ */
+ public static final int USER_ACTIVITY_EVENT_OTHER = 0;
+
+ /**
+ * User activity event type: Button or key pressed or released.
+ * @hide
+ */
+ public static final int USER_ACTIVITY_EVENT_BUTTON = 1;
+
+ /**
+ * User activity event type: Touch down, move or up.
+ * @hide
+ */
+ public static final int USER_ACTIVITY_EVENT_TOUCH = 2;
+
final IPowerManager mService;
final Handler mHandler;
@@ -298,20 +336,25 @@ public final class PowerManager {
* @see #ON_AFTER_RELEASE
*/
public WakeLock newWakeLock(int levelAndFlags, String tag) {
- switch (levelAndFlags & LOCK_MASK) {
- case PARTIAL_WAKE_LOCK:
- case SCREEN_DIM_WAKE_LOCK:
- case SCREEN_BRIGHT_WAKE_LOCK:
- case FULL_WAKE_LOCK:
- case PROXIMITY_SCREEN_OFF_WAKE_LOCK:
- break;
- default:
- throw new IllegalArgumentException("Must specify a wake lock level.");
+ validateWakeLockParameters(levelAndFlags, tag);
+ return new WakeLock(levelAndFlags, tag);
+ }
+
+ /** @hide */
+ public static void validateWakeLockParameters(int levelAndFlags, String tag) {
+ switch (levelAndFlags & WAKE_LOCK_LEVEL_MASK) {
+ case PARTIAL_WAKE_LOCK:
+ case SCREEN_DIM_WAKE_LOCK:
+ case SCREEN_BRIGHT_WAKE_LOCK:
+ case FULL_WAKE_LOCK:
+ case PROXIMITY_SCREEN_OFF_WAKE_LOCK:
+ break;
+ default:
+ throw new IllegalArgumentException("Must specify a valid wake lock level.");
}
if (tag == null) {
throw new IllegalArgumentException("The tag must not be null.");
}
- return new WakeLock(levelAndFlags, tag);
}
/**
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 287c136c63d1..a85f4fa1e0b7 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -76,6 +76,20 @@ public class WorkSource implements Parcelable {
mNum = 0;
}
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof WorkSource && !diff((WorkSource)o);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 0;
+ for (int i = 0; i < mNum; i++) {
+ result = ((result << 4) | (result >>> 28)) ^ mUids[i];
+ }
+ return result;
+ }
+
/**
* Compare this WorkSource with another.
* @param other The WorkSource to compare against.
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index fbf512c843bb..cb6c1dc4cf97 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -289,7 +289,7 @@ public class StorageManager
* Constructs a StorageManager object through which an application can
* can communicate with the systems mount service.
*
- * @param tgtLooper The {@android.os.Looper} which events will be received on.
+ * @param tgtLooper The {@link android.os.Looper} which events will be received on.
*
* <p>Applications can get instance of this class by calling
* {@link android.content.Context#getSystemService(java.lang.String)} with an argument
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index 8df4339f3740..336960e234e7 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -55,6 +55,13 @@ import java.util.Set;
* {@link SharedPreferences}. It is up to the subclass to decide how to store
* the value.
*
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For information about building a settings UI with Preferences,
+ * read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
+ * guide.</p>
+ * </div>
+ *
* @attr ref android.R.styleable#Preference_icon
* @attr ref android.R.styleable#Preference_key
* @attr ref android.R.styleable#Preference_title
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index 140bff04cc39..9bfa8c078817 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -84,6 +84,13 @@ import java.util.List;
* items. Doing this implicitly switches the class into its new "headers
* + fragments" mode rather than the old style of just showing a single
* preferences list.
+ *
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For information about using {@code PreferenceActivity},
+ * read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
+ * guide.</p>
+ * </div>
*
* <a name="SampleCode"></a>
* <h3>Sample Code</h3>
diff --git a/core/java/android/preference/PreferenceCategory.java b/core/java/android/preference/PreferenceCategory.java
index 237c5ce8c84a..d8af3248f7d2 100644
--- a/core/java/android/preference/PreferenceCategory.java
+++ b/core/java/android/preference/PreferenceCategory.java
@@ -24,6 +24,13 @@ import android.util.AttributeSet;
/**
* Used to group {@link Preference} objects
* and provide a disabled title above the group.
+ *
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For information about building a settings UI with Preferences,
+ * read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
+ * guide.</p>
+ * </div>
*/
public class PreferenceCategory extends PreferenceGroup {
private static final String TAG = "PreferenceCategory";
diff --git a/core/java/android/preference/PreferenceFragment.java b/core/java/android/preference/PreferenceFragment.java
index bdd858ba6ef2..11d8878274c9 100644
--- a/core/java/android/preference/PreferenceFragment.java
+++ b/core/java/android/preference/PreferenceFragment.java
@@ -74,6 +74,13 @@ import android.widget.ListView;
* As a convenience, this fragment implements a click listener for any
* preference in the current hierarchy, see
* {@link #onPreferenceTreeClick(PreferenceScreen, Preference)}.
+ *
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For information about using {@code PreferenceFragment},
+ * read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
+ * guide.</p>
+ * </div>
*
* <a name="SampleCode"></a>
* <h3>Sample Code</h3>
diff --git a/core/java/android/preference/PreferenceGroup.java b/core/java/android/preference/PreferenceGroup.java
index d008fd699ed9..f33a6be9ff55 100644
--- a/core/java/android/preference/PreferenceGroup.java
+++ b/core/java/android/preference/PreferenceGroup.java
@@ -33,6 +33,13 @@ import android.util.AttributeSet;
* {@link Preference} objects. It is a base class for Preference objects that are
* parents, such as {@link PreferenceCategory} and {@link PreferenceScreen}.
*
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For information about building a settings UI with Preferences,
+ * read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
+ * guide.</p>
+ * </div>
+ *
* @attr ref android.R.styleable#PreferenceGroup_orderingFromXml
*/
public abstract class PreferenceGroup extends Preference implements GenericInflater.Parent<Preference> {
diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java
index 6562de90a3c8..5ca7d79c1394 100644
--- a/core/java/android/preference/PreferenceManager.java
+++ b/core/java/android/preference/PreferenceManager.java
@@ -415,19 +415,20 @@ public class PreferenceManager {
}
/**
- * Sets the default values from a preference hierarchy in XML. This should
+ * Sets the default values from an XML preference file by reading the values defined
+ * by each {@link Preference} item's {@code android:defaultValue} attribute. This should
* be called by the application's main activity.
* <p>
- * If {@code readAgain} is false, this will only set the default values if this
- * method has never been called in the past (or the
- * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared
- * preferences file is false). To attempt to set the default values again
- * bypassing this check, set {@code readAgain} to true.
*
* @param context The context of the shared preferences.
- * @param resId The resource ID of the preference hierarchy XML file.
+ * @param resId The resource ID of the preference XML file.
* @param readAgain Whether to re-read the default values.
- * <p>
+ * If false, this method sets the default values only if this
+ * method has never been called in the past (or if the
+ * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared
+ * preferences file is false). To attempt to set the default values again
+ * bypassing this check, set {@code readAgain} to true.
+ * <p class="note">
* Note: this will NOT reset preferences back to their default
* values. For that functionality, use
* {@link PreferenceManager#getDefaultSharedPreferences(Context)}
@@ -445,6 +446,25 @@ public class PreferenceManager {
* Similar to {@link #setDefaultValues(Context, int, boolean)} but allows
* the client to provide the filename and mode of the shared preferences
* file.
+ *
+ * @param context The context of the shared preferences.
+ * @param sharedPreferencesName A custom name for the shared preferences file.
+ * @param sharedPreferencesMode The file creation mode for the shared preferences file, such
+ * as {@link android.content.Context#MODE_PRIVATE} or {@link
+ * android.content.Context#MODE_PRIVATE}
+ * @param resId The resource ID of the preference XML file.
+ * @param readAgain Whether to re-read the default values.
+ * If false, this method will set the default values only if this
+ * method has never been called in the past (or if the
+ * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared
+ * preferences file is false). To attempt to set the default values again
+ * bypassing this check, set {@code readAgain} to true.
+ * <p class="note">
+ * Note: this will NOT reset preferences back to their default
+ * values. For that functionality, use
+ * {@link PreferenceManager#getDefaultSharedPreferences(Context)}
+ * and clear it followed by a call to this method with this
+ * parameter set to true.
*
* @see #setDefaultValues(Context, int, boolean)
* @see #setSharedPreferencesName(String)
diff --git a/core/java/android/preference/PreferenceScreen.java b/core/java/android/preference/PreferenceScreen.java
index c17111ab8dcd..db806760fb68 100644
--- a/core/java/android/preference/PreferenceScreen.java
+++ b/core/java/android/preference/PreferenceScreen.java
@@ -75,6 +75,13 @@ import android.widget.ListView;
* clicked will show another screen of preferences such as "Prefer WiFi" (and
* the other preferences that are children of the "second_preferencescreen" tag).
*
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For information about building a settings UI with Preferences,
+ * read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
+ * guide.</p>
+ * </div>
+ *
* @see PreferenceCategory
*/
public final class PreferenceScreen extends PreferenceGroup implements AdapterView.OnItemClickListener,
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index f8501a9e6682..6f45ca79b45b 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -40,6 +40,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.util.Log;
import android.util.LogPrinter;
+import android.view.Display;
import android.view.Gravity;
import android.view.IWindowSession;
import android.view.InputChannel;
@@ -612,8 +613,8 @@ public abstract class WallpaperService extends Service {
mLayout.windowAnimations =
com.android.internal.R.style.Animation_Wallpaper;
mInputChannel = new InputChannel();
- if (mSession.add(mWindow, mWindow.mSeq, mLayout, View.VISIBLE, mContentInsets,
- mInputChannel) < 0) {
+ if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
+ Display.DEFAULT_DISPLAY, mContentInsets, mInputChannel) < 0) {
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
return;
}
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index ce49268fec72..46e4d6ed5cce 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -17,20 +17,56 @@
package android.view;
import android.content.res.CompatibilityInfo;
+import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
+import android.hardware.display.DisplayManager;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.util.DisplayMetrics;
-import android.util.Slog;
+import android.util.Log;
/**
- * Provides information about the display size and density.
+ * Provides information about the size and density of a logical display.
+ * <p>
+ * The display area is described in two different ways.
+ * <ul>
+ * <li>The application display area specifies the part of the display that may contain
+ * an application window, excluding the system decorations. The application display area may
+ * be smaller than the real display area because the system subtracts the space needed
+ * for decor elements such as the status bar. Use the following methods to query the
+ * application display area: {@link #getSize}, {@link #getRectSize} and {@link #getMetrics}.</li>
+ * <li>The real display area specifies the part of the display that contains content
+ * including the system decorations. Even so, the real display area may be smaller than the
+ * physical size of the display if the window manager is emulating a smaller display
+ * using (adb shell am display-size). Use the following methods to query the
+ * real display area: {@link #getRealSize}, {@link #getRealMetrics}.</li>
+ * </ul>
+ * </p><p>
+ * A logical display does not necessarily represent a particular physical display device
+ * such as the built-in screen or an external monitor. The contents of a logical
+ * display may be presented on one or more physical displays according to the devices
+ * that are currently attached and whether mirroring has been enabled.
+ * </p>
*/
-public class Display {
- static final String TAG = "Display";
- static final boolean DEBUG_DISPLAY_SIZE = false;
+public final class Display {
+ private static final String TAG = "Display";
+
+ private final int mDisplayId;
+ private final CompatibilityInfoHolder mCompatibilityInfo;
+ private final DisplayInfo mDisplayInfo = new DisplayInfo();
+
+ // Temporary display metrics structure used for compatibility mode.
+ private final DisplayMetrics mTempMetrics = new DisplayMetrics();
+
+ // We cache the app width and height properties briefly between calls
+ // to getHeight() and getWidth() to ensure that applications perceive
+ // consistent results when the size changes (most of the time).
+ // Applications should now be using getSize() instead.
+ private static final int CACHED_APP_SIZE_DURATION_MILLIS = 20;
+ private long mLastCachedAppSizeUpdate;
+ private int mCachedAppWidthCompat;
+ private int mCachedAppHeightCompat;
/**
* The default Display id.
@@ -38,40 +74,29 @@ public class Display {
public static final int DEFAULT_DISPLAY = 0;
/**
- * Use {@link android.view.WindowManager#getDefaultDisplay()
- * WindowManager.getDefaultDisplay()} to create a Display object.
- * Display gives you access to some information about a particular display
- * connected to the device.
+ * Internal method to create a display.
+ * Applications should use {@link android.view.WindowManager#getDefaultDisplay()}
+ * to get a display object for the default display.
+ *
+ * @hide
*/
- Display(int display, CompatibilityInfoHolder compatInfo) {
- // initalize the statics when this class is first instansiated. This is
- // done here instead of in the static block because Zygote
- synchronized (sStaticInit) {
- if (!sInitialized) {
- nativeClassInit();
- sInitialized = true;
- }
- }
- mCompatibilityInfo = compatInfo != null ? compatInfo : new CompatibilityInfoHolder();
- mDisplay = display;
- init(display);
+ public Display(int displayId, CompatibilityInfoHolder compatibilityInfo) {
+ mDisplayId = displayId;
+ mCompatibilityInfo = compatibilityInfo;
}
/**
- * Returns the index of this display. This is currently undefined; do
- * not use.
+ * Gets the display id.
+ * <p>
+ * Each logical display has a unique id.
+ * The default display has id {@link #DEFAULT_DISPLAY}.
+ * </p>
*/
public int getDisplayId() {
- return mDisplay;
+ return mDisplayId;
}
/**
- * Returns the number of displays connected to the device. This is
- * currently undefined; do not use.
- */
- native static int getDisplayCount();
-
- /**
* Gets the size of the display, in pixels.
* <p>
* Note that this value should <em>not</em> be used for computing layouts,
@@ -84,7 +109,7 @@ public class Display {
* </p><p>
* The size returned by this method does not necessarily represent the
* actual raw size (native resolution) of the display. The returned size may
- * be adjusted to exclude certain system decor elements that are always visible.
+ * be adjusted to exclude certain system decoration elements that are always visible.
* It may also be scaled to provide compatibility with older applications that
* were originally designed for smaller displays.
* </p>
@@ -92,43 +117,14 @@ public class Display {
* @param outSize A {@link Point} object to receive the size information.
*/
public void getSize(Point outSize) {
- getSizeInternal(outSize, true);
- }
-
- private void getSizeInternal(Point outSize, boolean doCompat) {
- try {
- IWindowManager wm = getWindowManager();
- if (wm != null) {
- wm.getDisplaySize(outSize);
- CompatibilityInfo ci;
- if (doCompat && (ci=mCompatibilityInfo.getIfNeeded()) != null) {
- synchronized (mTmpMetrics) {
- mTmpMetrics.noncompatWidthPixels = outSize.x;
- mTmpMetrics.noncompatHeightPixels = outSize.y;
- mTmpMetrics.density = mDensity;
- ci.applyToDisplayMetrics(mTmpMetrics);
- outSize.x = mTmpMetrics.widthPixels;
- outSize.y = mTmpMetrics.heightPixels;
- }
- }
- } else {
- // This is just for boot-strapping, initializing the
- // system process before the window manager is up.
- outSize.x = getRawWidth();
- outSize.y = getRawHeight();
- }
- if (false) {
- RuntimeException here = new RuntimeException("here");
- here.fillInStackTrace();
- Slog.v(TAG, "Returning display size: " + outSize, here);
- }
- if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v(
- TAG, "Returning display size: " + outSize);
- } catch (RemoteException e) {
- Slog.w("Display", "Unable to get display size", e);
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
+ outSize.x = mTempMetrics.widthPixels;
+ outSize.y = mTempMetrics.heightPixels;
}
}
-
+
/**
* Gets the size of the display as a rectangle, in pixels.
*
@@ -136,9 +132,10 @@ public class Display {
* @see #getSize(Point)
*/
public void getRectSize(Rect outSize) {
- synchronized (mTmpPoint) {
- getSizeInternal(mTmpPoint, true);
- outSize.set(0, 0, mTmpPoint.x, mTmpPoint.y);
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
+ outSize.set(0, 0, mTempMetrics.widthPixels, mTempMetrics.heightPixels);
}
}
@@ -173,15 +170,12 @@ public class Display {
* for example, screen decorations like the status bar are being hidden.
*/
public void getCurrentSizeRange(Point outSmallestSize, Point outLargestSize) {
- try {
- IWindowManager wm = getWindowManager();
- wm.getCurrentSizeRange(outSmallestSize, outLargestSize);
- } catch (RemoteException e) {
- Slog.w("Display", "Unable to get display size range", e);
- outSmallestSize.x = 0;
- outSmallestSize.y = 0;
- outLargestSize.x = 0;
- outLargestSize.y = 0;
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ outSmallestSize.x = mDisplayInfo.smallestNominalAppWidth;
+ outSmallestSize.y = mDisplayInfo.smallestNominalAppHeight;
+ outLargestSize.x = mDisplayInfo.largestNominalAppWidth;
+ outLargestSize.y = mDisplayInfo.largestNominalAppHeight;
}
}
@@ -191,12 +185,9 @@ public class Display {
* @hide
*/
public int getMaximumSizeDimension() {
- try {
- IWindowManager wm = getWindowManager();
- return wm.getMaximumSizeDimension();
- } catch (RemoteException e) {
- Slog.w("Display", "Unable to get display maximum size dimension", e);
- return 0;
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ return Math.max(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
}
}
@@ -205,13 +196,9 @@ public class Display {
*/
@Deprecated
public int getWidth() {
- synchronized (mTmpPoint) {
- long now = SystemClock.uptimeMillis();
- if (now > (mLastGetTime+20)) {
- getSizeInternal(mTmpPoint, true);
- mLastGetTime = now;
- }
- return mTmpPoint.x;
+ synchronized (this) {
+ updateCachedAppSizeIfNeededLocked();
+ return mCachedAppWidthCompat;
}
}
@@ -220,76 +207,13 @@ public class Display {
*/
@Deprecated
public int getHeight() {
- synchronized (mTmpPoint) {
- long now = SystemClock.uptimeMillis();
- if (now > (mLastGetTime+20)) {
- getSizeInternal(mTmpPoint, true);
- mLastGetTime = now;
- }
- return mTmpPoint.y;
- }
- }
-
- /**
- * Gets the real size of the display without subtracting any window decor or
- * applying any compatibility scale factors.
- * <p>
- * The real size may be smaller than the raw size when the window manager
- * is emulating a smaller display (using adb shell am display-size).
- * </p><p>
- * The size is adjusted based on the current rotation of the display.
- * </p>
- * @hide
- */
- public void getRealSize(Point outSize) {
- try {
- IWindowManager wm = getWindowManager();
- if (wm != null) {
- wm.getRealDisplaySize(outSize);
- } else {
- // This is just for boot-strapping, initializing the
- // system process before the window manager is up.
- outSize.x = getRawWidth();
- outSize.y = getRawHeight();
- }
- if (DEBUG_DISPLAY_SIZE) Slog.v(
- TAG, "Returning real display size: " + outSize);
- } catch (RemoteException e) {
- Slog.w("Display", "Unable to get real display size", e);
+ synchronized (this) {
+ updateCachedAppSizeIfNeededLocked();
+ return mCachedAppHeightCompat;
}
}
/**
- * Gets the raw width of the display, in pixels.
- * <p>
- * The size is adjusted based on the current rotation of the display.
- * </p>
- * @hide
- */
- public int getRawWidth() {
- int w = getRawWidthNative();
- if (DEBUG_DISPLAY_SIZE) Slog.v(
- TAG, "Returning raw display width: " + w);
- return w;
- }
- private native int getRawWidthNative();
-
- /**
- * Gets the raw height of the display, in pixels.
- * <p>
- * The size is adjusted based on the current rotation of the display.
- * </p>
- * @hide
- */
- public int getRawHeight() {
- int h = getRawHeightNative();
- if (DEBUG_DISPLAY_SIZE) Slog.v(
- TAG, "Returning raw display height: " + h);
- return h;
- }
- private native int getRawHeightNative();
-
- /**
* Returns the rotation of the screen from its "natural" orientation.
* The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0}
* (no rotation), {@link Surface#ROTATION_90 Surface.ROTATION_90},
@@ -307,30 +231,43 @@ public class Display {
* {@link Surface#ROTATION_90 Surface.ROTATION_90}.
*/
public int getRotation() {
- return getOrientation();
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ return mDisplayInfo.rotation;
+ }
}
-
+
/**
* @deprecated use {@link #getRotation}
* @return orientation of this display.
*/
- @Deprecated native public int getOrientation();
+ @Deprecated
+ public int getOrientation() {
+ return getRotation();
+ }
/**
- * Return the native pixel format of the display. The returned value
- * may be one of the constants int {@link android.graphics.PixelFormat}.
+ * Gets the pixel format of the display.
+ * @return One of the constants defined in {@link android.graphics.PixelFormat}.
+ *
+ * @deprecated This method is no longer supported.
+ * The result is always {@link PixelFormat#RGBA_8888}.
*/
+ @Deprecated
public int getPixelFormat() {
- return mPixelFormat;
+ return PixelFormat.RGBA_8888;
}
-
+
/**
- * Return the refresh rate of this display in frames per second.
+ * Gets the refresh rate of this display in frames per second.
*/
public float getRefreshRate() {
- return mRefreshRate;
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ return mDisplayInfo.refreshRate;
+ }
}
-
+
/**
* Gets display metrics that describe the size and density of this display.
* <p>
@@ -346,109 +283,71 @@ public class Display {
* @param outMetrics A {@link DisplayMetrics} object to receive the metrics.
*/
public void getMetrics(DisplayMetrics outMetrics) {
- synchronized (mTmpPoint) {
- getSizeInternal(mTmpPoint, false);
- getMetricsWithSize(outMetrics, mTmpPoint.x, mTmpPoint.y);
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ mDisplayInfo.getAppMetrics(outMetrics, mCompatibilityInfo);
}
- CompatibilityInfo ci = mCompatibilityInfo.getIfNeeded();
+ final CompatibilityInfo ci = mCompatibilityInfo.getIfNeeded();
if (ci != null) {
ci.applyToDisplayMetrics(outMetrics);
}
-
- if (DEBUG_DISPLAY_SIZE) Slog.v(TAG, "Returning DisplayMetrics: "
- + outMetrics.widthPixels + "x" + outMetrics.heightPixels
- + " " + outMetrics.density);
}
/**
- * Gets display metrics based on the real size of this display.
- * @hide
+ * Gets the real size of the display without subtracting any window decor or
+ * applying any compatibility scale factors.
+ * <p>
+ * The size is adjusted based on the current rotation of the display.
+ * </p><p>
+ * The real size may be smaller than the physical size of the screen when the
+ * window manager is emulating a smaller display (using adb shell am display-size).
+ * </p>
+ *
+ * @param outSize Set to the real size of the display.
*/
- public void getRealMetrics(DisplayMetrics outMetrics) {
- synchronized (mTmpPoint) {
- getRealSize(mTmpPoint);
- getMetricsWithSize(outMetrics, mTmpPoint.x, mTmpPoint.y);
+ public void getRealSize(Point outSize) {
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ outSize.x = mDisplayInfo.logicalWidth;
+ outSize.y = mDisplayInfo.logicalHeight;
}
}
/**
- * If the display is mirrored to an external HDMI display, returns the
- * width of that display.
- * @hide
- */
- public int getRawExternalWidth() {
- return 1280;
- }
-
- /**
- * If the display is mirrored to an external HDMI display, returns the
- * height of that display.
- * @hide
- */
- public int getRawExternalHeight() {
- return 720;
- }
-
- /**
- * If the display is mirrored to an external HDMI display, returns the
- * rotation of that display relative to its natural orientation.
- * @hide
+ * Gets display metrics based on the real size of this display.
+ * <p>
+ * The size is adjusted based on the current rotation of the display.
+ * </p><p>
+ * The real size may be smaller than the physical size of the screen when the
+ * window manager is emulating a smaller display (using adb shell am display-size).
+ * </p>
+ *
+ * @param outMetrics A {@link DisplayMetrics} object to receive the metrics.
*/
- public int getExternalRotation() {
- return Surface.ROTATION_0;
+ public void getRealMetrics(DisplayMetrics outMetrics) {
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ mDisplayInfo.getLogicalMetrics(outMetrics, null);
+ }
}
- /**
- * Gets display metrics based on an explicit assumed display size.
- * @hide
- */
- public void getMetricsWithSize(DisplayMetrics outMetrics,
- int width, int height) {
- outMetrics.densityDpi = (int)((mDensity*DisplayMetrics.DENSITY_DEFAULT)+.5f);
-
- outMetrics.noncompatWidthPixels = outMetrics.widthPixels = width;
- outMetrics.noncompatHeightPixels = outMetrics.heightPixels = height;
-
- outMetrics.density = outMetrics.noncompatDensity = mDensity;
- outMetrics.scaledDensity = outMetrics.noncompatScaledDensity = outMetrics.density;
- outMetrics.xdpi = outMetrics.noncompatXdpi = mDpiX;
- outMetrics.ydpi = outMetrics.noncompatYdpi = mDpiY;
+ private void updateDisplayInfoLocked() {
+ // TODO: only refresh the display information when needed
+ if (!DisplayManager.getInstance().getDisplayInfo(mDisplayId, mDisplayInfo)) {
+ Log.e(TAG, "Could not get information about logical display " + mDisplayId);
+ }
}
- static IWindowManager getWindowManager() {
- synchronized (sStaticInit) {
- if (sWindowManager == null) {
- sWindowManager = IWindowManager.Stub.asInterface(
- ServiceManager.getService("window"));
- }
- return sWindowManager;
+ private void updateCachedAppSizeIfNeededLocked() {
+ long now = SystemClock.uptimeMillis();
+ if (now > mLastCachedAppSizeUpdate + CACHED_APP_SIZE_DURATION_MILLIS) {
+ updateDisplayInfoLocked();
+ mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
+ mCachedAppWidthCompat = mTempMetrics.widthPixels;
+ mCachedAppHeightCompat = mTempMetrics.heightPixels;
+ mLastCachedAppSizeUpdate = now;
}
}
-
- /*
- * We use a class initializer to allow the native code to cache some
- * field offsets.
- */
- native private static void nativeClassInit();
-
- private native void init(int display);
-
- private final CompatibilityInfoHolder mCompatibilityInfo;
- private final int mDisplay;
- // Following fields are initialized from native code
- private int mPixelFormat;
- private float mRefreshRate;
- /*package*/ float mDensity;
- /*package*/ float mDpiX;
- /*package*/ float mDpiY;
-
- private final Point mTmpPoint = new Point();
- private final DisplayMetrics mTmpMetrics = new DisplayMetrics();
- private float mLastGetTime;
-
- private static final Object sStaticInit = new Object();
- private static boolean sInitialized = false;
- private static IWindowManager sWindowManager;
}
diff --git a/core/java/android/view/DisplayInfo.aidl b/core/java/android/view/DisplayInfo.aidl
new file mode 100644
index 000000000000..e679208e73f7
--- /dev/null
+++ b/core/java/android/view/DisplayInfo.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view;
+
+parcelable DisplayInfo;
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
new file mode 100644
index 000000000000..69b6d6798a3e
--- /dev/null
+++ b/core/java/android/view/DisplayInfo.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view;
+
+import android.content.res.CompatibilityInfo;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.DisplayMetrics;
+
+/**
+ * Describes the characteristics of a particular logical display.
+ * @hide
+ */
+public final class DisplayInfo implements Parcelable {
+ /**
+ * The width of the portion of the display that is available to applications, in pixels.
+ * Represents the size of the display minus any system decorations.
+ */
+ public int appWidth;
+
+ /**
+ * The height of the portion of the display that is available to applications, in pixels.
+ * Represents the size of the display minus any system decorations.
+ */
+ public int appHeight;
+
+ /**
+ * The smallest value of {@link #appWidth} that an application is likely to encounter,
+ * in pixels, excepting cases where the width may be even smaller due to the presence
+ * of a soft keyboard, for example.
+ */
+ public int smallestNominalAppWidth;
+
+ /**
+ * The smallest value of {@link #appHeight} that an application is likely to encounter,
+ * in pixels, excepting cases where the height may be even smaller due to the presence
+ * of a soft keyboard, for example.
+ */
+ public int smallestNominalAppHeight;
+
+ /**
+ * The largest value of {@link #appWidth} that an application is likely to encounter,
+ * in pixels, excepting cases where the width may be even larger due to system decorations
+ * such as the status bar being hidden, for example.
+ */
+ public int largestNominalAppWidth;
+
+ /**
+ * The largest value of {@link #appHeight} that an application is likely to encounter,
+ * in pixels, excepting cases where the height may be even larger due to system decorations
+ * such as the status bar being hidden, for example.
+ */
+ public int largestNominalAppHeight;
+
+ /**
+ * The logical width of the display, in pixels.
+ * Represents the usable size of the display which may be smaller than the
+ * physical size when the system is emulating a smaller display.
+ */
+ public int logicalWidth;
+
+ /**
+ * The logical height of the display, in pixels.
+ * Represents the usable size of the display which may be smaller than the
+ * physical size when the system is emulating a smaller display.
+ */
+ public int logicalHeight;
+
+ /**
+ * The rotation of the display relative to its natural orientation.
+ * May be one of {@link android.view.Surface#ROTATION_0},
+ * {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180},
+ * {@link android.view.Surface#ROTATION_270}.
+ * <p>
+ * The value of this field is indeterminate if the logical display is presented on
+ * more than one physical display.
+ * </p>
+ */
+ public int rotation;
+
+ /**
+ * The refresh rate of this display in frames per second.
+ * <p>
+ * The value of this field is indeterminate if the logical display is presented on
+ * more than one physical display.
+ * </p>
+ */
+ public float refreshRate;
+
+ /**
+ * The logical display density which represents the scaling factor for
+ * the Density Independent Pixel unit.
+ */
+ public float logicalDensity;
+
+ /**
+ * The exact physical pixels per inch of the screen in the X dimension.
+ * <p>
+ * The value of this field is indeterminate if the logical display is presented on
+ * more than one physical display.
+ * </p>
+ */
+ public float physicalXDpi;
+
+ /**
+ * The exact physical pixels per inch of the screen in the Y dimension.
+ * <p>
+ * The value of this field is indeterminate if the logical display is presented on
+ * more than one physical display.
+ * </p>
+ */
+ public float physicalYDpi;
+
+ public static final Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
+ public DisplayInfo createFromParcel(Parcel source) {
+ return new DisplayInfo(source);
+ }
+
+ public DisplayInfo[] newArray(int size) {
+ return new DisplayInfo[size];
+ }
+ };
+
+ public DisplayInfo() {
+ }
+
+ private DisplayInfo(Parcel source) {
+ readFromParcel(source);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ public void copyFrom(DisplayInfo other) {
+ appWidth = other.appWidth;
+ appHeight = other.appHeight;
+ smallestNominalAppWidth = other.smallestNominalAppWidth;
+ smallestNominalAppHeight = other.smallestNominalAppHeight;
+ largestNominalAppWidth = other.largestNominalAppWidth;
+ largestNominalAppHeight = other.largestNominalAppHeight;
+ logicalWidth = other.logicalWidth;
+ logicalHeight = other.logicalHeight;
+ rotation = other.rotation;
+ refreshRate = other.refreshRate;
+ logicalDensity = other.logicalDensity;
+ physicalXDpi = other.physicalXDpi;
+ physicalYDpi = other.physicalYDpi;
+ }
+
+ public void readFromParcel(Parcel source) {
+ appWidth = source.readInt();
+ appHeight = source.readInt();
+ smallestNominalAppWidth = source.readInt();
+ smallestNominalAppHeight = source.readInt();
+ largestNominalAppWidth = source.readInt();
+ largestNominalAppHeight = source.readInt();
+ logicalWidth = source.readInt();
+ logicalHeight = source.readInt();
+ rotation = source.readInt();
+ refreshRate = source.readFloat();
+ logicalDensity = source.readFloat();
+ physicalXDpi = source.readFloat();
+ physicalYDpi = source.readFloat();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(appWidth);
+ dest.writeInt(appHeight);
+ dest.writeInt(smallestNominalAppWidth);
+ dest.writeInt(smallestNominalAppHeight);
+ dest.writeInt(largestNominalAppWidth);
+ dest.writeInt(largestNominalAppHeight);
+ dest.writeInt(logicalWidth);
+ dest.writeInt(logicalHeight);
+ dest.writeInt(rotation);
+ dest.writeFloat(refreshRate);
+ dest.writeFloat(logicalDensity);
+ dest.writeFloat(physicalXDpi);
+ dest.writeFloat(physicalYDpi);
+ }
+
+ public void getAppMetrics(DisplayMetrics outMetrics, CompatibilityInfoHolder cih) {
+ getMetricsWithSize(outMetrics, cih, appWidth, appHeight);
+ }
+
+ public void getLogicalMetrics(DisplayMetrics outMetrics, CompatibilityInfoHolder cih) {
+ getMetricsWithSize(outMetrics, cih, logicalWidth, logicalHeight);
+ }
+
+ private void getMetricsWithSize(DisplayMetrics outMetrics, CompatibilityInfoHolder cih,
+ int width, int height) {
+ outMetrics.densityDpi =
+ (int)((logicalDensity * DisplayMetrics.DENSITY_DEFAULT) + .5f);
+ outMetrics.noncompatWidthPixels = outMetrics.widthPixels = width;
+ outMetrics.noncompatHeightPixels = outMetrics.heightPixels = height;
+
+ outMetrics.density = outMetrics.noncompatDensity = logicalDensity;
+ outMetrics.scaledDensity = outMetrics.noncompatScaledDensity = outMetrics.density;
+ outMetrics.xdpi = outMetrics.noncompatXdpi = physicalXDpi;
+ outMetrics.ydpi = outMetrics.noncompatYdpi = physicalYDpi;
+
+ if (cih != null) {
+ CompatibilityInfo ci = cih.getIfNeeded();
+ if (ci != null) {
+ ci.applyToDisplayMetrics(outMetrics);
+ }
+ }
+ }
+}
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 5941e448d3ff..f8d9378ede08 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -56,11 +56,6 @@ interface IWindowManager
IWindowSession openSession(in IInputMethodClient client,
in IInputContext inputContext);
boolean inputMethodClientHasFocus(IInputMethodClient client);
-
- void getDisplaySize(out Point size);
- void getRealDisplaySize(out Point size);
- int getMaximumSizeDimension();
- void getCurrentSizeRange(out Point smallestSize, out Point largestSize);
void setForcedDisplaySize(int longDimen, int shortDimen);
void clearForcedDisplaySize();
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index 0dc14d5763ef..e93e4805a7a6 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -37,8 +37,13 @@ interface IWindowSession {
int add(IWindow window, int seq, in WindowManager.LayoutParams attrs,
in int viewVisibility, out Rect outContentInsets,
out InputChannel outInputChannel);
+ int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
+ in int viewVisibility, in int layerStackId, out Rect outContentInsets,
+ out InputChannel outInputChannel);
int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
in int viewVisibility, out Rect outContentInsets);
+ int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
+ in int viewVisibility, in int layerStackId, out Rect outContentInsets);
void remove(IWindow window);
/**
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 11050385b12e..abab2684489f 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -248,7 +248,7 @@ public class Surface implements Parcelable {
/** create a surface @hide */
public Surface(SurfaceSession s,
- int pid, int display, int w, int h, int format, int flags)
+ int pid, int displayId, int w, int h, int format, int flags)
throws OutOfResourcesException {
checkHeadless();
@@ -256,12 +256,12 @@ public class Surface implements Parcelable {
mCreationStack = new Exception();
}
mCanvas = new CompatibleCanvas();
- init(s,pid,null,display,w,h,format,flags);
+ init(s,pid,null,displayId,w,h,format,flags);
}
/** create a surface with a name @hide */
public Surface(SurfaceSession s,
- int pid, String name, int display, int w, int h, int format, int flags)
+ int pid, String name, int displayId, int w, int h, int format, int flags)
throws OutOfResourcesException {
checkHeadless();
@@ -269,7 +269,7 @@ public class Surface implements Parcelable {
mCreationStack = new Exception();
}
mCanvas = new CompatibleCanvas();
- init(s,pid,name,display,w,h,format,flags);
+ init(s,pid,name,displayId,w,h,format,flags);
mName = name;
}
@@ -403,31 +403,16 @@ public class Surface implements Parcelable {
public native void destroy();
private native Canvas lockCanvasNative(Rect dirty);
-
- /*
- * set display parameters & screenshots
- */
/**
* set the orientation of the given display.
* @param display
* @param orientation
- * @param flags Currently unused, set to 0.
* @hide
*/
- public static native void setOrientation(int display, int orientation, int flags);
+ public static native void setOrientation(int display, int orientation);
/**
- * set the orientation of the given display.
- * @param display
- * @param orientation
- * @hide
- */
- public static void setOrientation(int display, int orientation) {
- setOrientation(display, orientation, 0);
- }
-
- /**
* Like {@link #screenshot(int, int, int, int)} but includes all
* Surfaces in the screenshot.
*
@@ -523,7 +508,7 @@ public class Surface implements Parcelable {
}
private native void init(SurfaceSession s,
- int pid, String name, int display, int w, int h, int format, int flags)
+ int pid, String name, int displayId, int w, int h, int format, int flags)
throws OutOfResourcesException;
private native void init(Parcel source);
diff --git a/core/java/android/view/SurfaceHolder.java b/core/java/android/view/SurfaceHolder.java
index 2a16725ad321..015a78e0daa6 100644
--- a/core/java/android/view/SurfaceHolder.java
+++ b/core/java/android/view/SurfaceHolder.java
@@ -155,7 +155,7 @@ public interface SurfaceHolder {
/**
* Make the surface a fixed size. It will never change from this size.
- * When working with a {link SurfaceView}, this must be called from the
+ * When working with a {@link SurfaceView}, this must be called from the
* same thread running the SurfaceView's window.
*
* @param width The surface's width.
@@ -167,14 +167,14 @@ public interface SurfaceHolder {
* Allow the surface to resized based on layout of its container (this is
* the default). When this is enabled, you should monitor
* {@link Callback#surfaceChanged} for changes to the size of the surface.
- * When working with a {link SurfaceView}, this must be called from the
+ * When working with a {@link SurfaceView}, this must be called from the
* same thread running the SurfaceView's window.
*/
public void setSizeFromLayout();
/**
* Set the desired PixelFormat of the surface. The default is OPAQUE.
- * When working with a {link SurfaceView}, this must be called from the
+ * When working with a {@link SurfaceView}, this must be called from the
* same thread running the SurfaceView's window.
*
* @param format A constant from PixelFormat.
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 5d516700873f..d3457b38be2f 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -459,8 +459,8 @@ public class SurfaceView extends View {
mWindow = new MyWindow(this);
mLayout.type = mWindowType;
mLayout.gravity = Gravity.START|Gravity.TOP;
- mSession.addWithoutInputChannel(mWindow, mWindow.mSeq, mLayout,
- mVisible ? VISIBLE : GONE, mContentInsets);
+ mSession.addToDisplayWithoutInputChannel(mWindow, mWindow.mSeq, mLayout,
+ mVisible ? VISIBLE : GONE, Display.DEFAULT_DISPLAY, mContentInsets);
}
boolean realSizeChanged;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index a89c970a985d..50c34076a267 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2224,7 +2224,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* with a stable layout. (Note that you should avoid using
* {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION} by itself.)
*
- * If you have set the window flag {@ WindowManager.LayoutParams#FLAG_FULLSCREEN}
+ * If you have set the window flag {@link WindowManager.LayoutParams#FLAG_FULLSCREEN}
* to hide the status bar (instead of using {@link #SYSTEM_UI_FLAG_FULLSCREEN}),
* then a hidden status bar will be considered a "stable" state for purposes
* here. This allows your UI to continually hide the status bar, while still
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 107f1cce73a7..3082976ec7ea 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -20,6 +20,7 @@ import android.app.AppGlobals;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.Point;
import android.os.RemoteException;
import android.provider.Settings;
import android.util.DisplayMetrics;
@@ -277,15 +278,17 @@ public class ViewConfiguration {
mDoubleTapSlop = (int) (sizeAndDensity * DOUBLE_TAP_SLOP + 0.5f);
mWindowTouchSlop = (int) (sizeAndDensity * WINDOW_TOUCH_SLOP + 0.5f);
- final Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
// Size of the screen in bytes, in ARGB_8888 format
- mMaximumDrawingCacheSize = 4 * display.getRawWidth() * display.getRawHeight();
+ final Display display = WindowManagerImpl.getDefault().getDefaultDisplay();
+ final Point size = new Point();
+ display.getRealSize(size);
+ mMaximumDrawingCacheSize = 4 * size.x * size.y;
mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
if (!sHasPermanentMenuKeySet) {
- IWindowManager wm = Display.getWindowManager();
+ IWindowManager wm = WindowManagerImpl.getWindowManagerService();
try {
sHasPermanentMenuKey = !wm.hasSystemNavBar() && !wm.hasNavigationBar();
sHasPermanentMenuKeySet = true;
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 5ae9a5f086eb..95eed3346adb 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -5159,7 +5159,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
/**
- * If {link #addStatesFromChildren} is true, refreshes this group's
+ * If {@link #addStatesFromChildren} is true, refreshes this group's
* drawable state (to include the states from its children).
*/
public void childDrawableStateChanged(View child) {
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index cd6c502ee519..befa0c0e3d46 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -331,7 +331,7 @@ public final class ViewRootImpl implements ViewParent,
if (!mInitialized) {
try {
InputMethodManager imm = InputMethodManager.getInstance(mainLooper);
- IWindowManager windowManager = Display.getWindowManager();
+ IWindowManager windowManager = WindowManagerImpl.getWindowManagerService();
sWindowSession = windowManager.openSession(
imm.getClient(), imm.getInputContext());
float animatorScale = windowManager.getAnimationScale(2);
@@ -544,9 +544,9 @@ public final class ViewRootImpl implements ViewParent,
mOrigWindowType = mWindowAttributes.type;
mAttachInfo.mRecomputeGlobalAttributes = true;
collectViewAttributes();
- res = sWindowSession.add(mWindow, mSeq, mWindowAttributes,
- getHostVisibility(), mAttachInfo.mContentInsets,
- mInputChannel);
+ res = sWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
+ getHostVisibility(), Display.DEFAULT_DISPLAY,
+ mAttachInfo.mContentInsets, mInputChannel);
} catch (RemoteException e) {
mAdded = false;
mView = null;
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index dedee97fa5b1..bd95cdb34ad6 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -21,6 +21,7 @@ import android.content.ComponentCallbacks2;
import android.content.res.Configuration;
import android.opengl.ManagedEGLContext;
import android.os.IBinder;
+import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.AndroidRuntimeException;
import android.util.Log;
@@ -111,6 +112,7 @@ public class WindowManagerImpl implements WindowManager {
public static final int ADD_PERMISSION_DENIED = -8;
private static WindowManagerImpl sDefaultWindowManager;
+ private static IWindowManager sWindowManagerService;
private final WindowManagerState mState;
private final Window mParentWindow;
@@ -135,6 +137,16 @@ public class WindowManagerImpl implements WindowManager {
}
}
+ public static IWindowManager getWindowManagerService() {
+ synchronized (WindowManagerImpl.class) {
+ if (sWindowManagerService == null) {
+ sWindowManagerService = IWindowManager.Stub.asInterface(
+ ServiceManager.getService("window"));
+ }
+ return sWindowManagerService;
+ }
+ }
+
public WindowManagerImpl makeLocal(Window parentWindow) {
return new WindowManagerImpl(mState, parentWindow, parentWindow.getCompatibilityInfo());
}
diff --git a/core/java/android/view/textservice/TextServicesManager.java b/core/java/android/view/textservice/TextServicesManager.java
index 161e8fb3e45b..81b36db50b29 100644
--- a/core/java/android/view/textservice/TextServicesManager.java
+++ b/core/java/android/view/textservice/TextServicesManager.java
@@ -91,11 +91,11 @@ public final class TextServicesManager {
/**
* Get a spell checker session for the specified spell checker
- * @param locale the locale for the spell checker. If {@param locale} is null and
+ * @param locale the locale for the spell checker. If {@code locale} is null and
* referToSpellCheckerLanguageSettings is true, the locale specified in Settings will be
- * returned. If {@param locale} is not null and referToSpellCheckerLanguageSettings is true,
- * the locale specified in Settings will be returned only when it is same as {@param locale}.
- * Exceptionally, when referToSpellCheckerLanguageSettings is true and {@param locale} is
+ * returned. If {@code locale} is not null and referToSpellCheckerLanguageSettings is true,
+ * the locale specified in Settings will be returned only when it is same as {@code locale}.
+ * Exceptionally, when referToSpellCheckerLanguageSettings is true and {@code locale} is
* only language (e.g. "en"), the specified locale in Settings (e.g. "en_US") will be
* selected.
* @param listener a spell checker session lister for getting results from a spell checker.
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 193e98d0ab10..49453708baee 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -72,6 +72,14 @@ public abstract class WebSettings {
TextSize(int size) {
value = size;
}
+
+ /**
+ * @hide Only for use by WebViewProvider implementations
+ */
+ public int getValue() {
+ return value;
+ }
+
int value;
}
@@ -90,6 +98,14 @@ public abstract class WebSettings {
ZoomDensity(int size) {
value = size;
}
+
+ /**
+ * @hide Only for use by WebViewProvider implementations
+ */
+ public int getValue() {
+ return value;
+ }
+
int value;
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 17592e876e10..6e4e82c85af9 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -66,8 +66,8 @@ import java.util.Map;
* href="{@docRoot}guide/topics/manifest/manifest-element.html">{@code <manifest>}</a>
* element.</p>
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-webview.html">Web View
- * tutorial</a>.</p>
+ * <p>For more information, read
+ * <a href="{@docRoot}guide/webapps/webview.html">Building Web Apps in WebView</a>.</p>
*
* <h3>Basic usage</h3>
*
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 130f0eeaac3f..61c942d15e3b 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -16,8 +16,6 @@
package android.widget;
-import com.android.internal.R;
-
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
@@ -68,6 +66,8 @@ import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
import android.view.inputmethod.InputMethodManager;
+import com.android.internal.R;
+
import java.util.ArrayList;
import java.util.List;
@@ -1668,6 +1668,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
ss.checkedItemCount = mCheckedItemCount;
+ if (mRemoteAdapter != null) {
+ mRemoteAdapter.saveRemoteViewsCache();
+ }
+
return ss;
}
@@ -5829,6 +5833,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mDeferNotifyDataSetChanged = false;
// Otherwise, create a new RemoteViewsAdapter for binding
mRemoteAdapter = new RemoteViewsAdapter(getContext(), intent, this);
+ if (mRemoteAdapter.isDataReady()) {
+ setAdapter(mRemoteAdapter);
+ }
}
/**
diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java
index c557963be752..2266cea8a92c 100644
--- a/core/java/android/widget/AdapterViewAnimator.java
+++ b/core/java/android/widget/AdapterViewAnimator.java
@@ -813,6 +813,9 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
+ if (mRemoteViewsAdapter != null) {
+ mRemoteViewsAdapter.saveRemoteViewsCache();
+ }
return new SavedState(superState, mWhichChild);
}
@@ -984,6 +987,9 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
mDeferNotifyDataSetChanged = false;
// Otherwise, create a new RemoteViewsAdapter for binding
mRemoteViewsAdapter = new RemoteViewsAdapter(getContext(), intent, this);
+ if (mRemoteViewsAdapter.isDataReady()) {
+ setAdapter(mRemoteViewsAdapter);
+ }
}
@Override
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index e5199f6fdf22..3b1532dd8929 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -75,8 +75,8 @@ import com.android.internal.R;
* }
* </pre>
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-autocomplete.html">Auto Complete
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/text.html">Text Fields</a>
+ * guide.</p>
*
* @attr ref android.R.styleable#AutoCompleteTextView_completionHint
* @attr ref android.R.styleable#AutoCompleteTextView_completionThreshold
@@ -1078,6 +1078,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
mPopup.setListItemExpandMax(EXPAND_MAX);
}
+ mPopup.setLayoutDirection(getResolvedLayoutDirection());
mPopup.show();
mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);
}
diff --git a/core/java/android/widget/Button.java b/core/java/android/widget/Button.java
index 99f4cae493cc..2ac56ac1c9cf 100644
--- a/core/java/android/widget/Button.java
+++ b/core/java/android/widget/Button.java
@@ -83,8 +83,8 @@ import android.widget.RemoteViews.RemoteView;
* href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">State List
* Drawable</a>.</p>
*
- * <p>Also see the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a> for an example implementation of a button.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/button.html">Buttons</a>
+ * guide.</p>
*
* <p><strong>XML attributes</strong></p>
* <p>
diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java
index 6d292dcafa83..41ab5f25f6db 100644
--- a/core/java/android/widget/CheckBox.java
+++ b/core/java/android/widget/CheckBox.java
@@ -45,8 +45,8 @@ import android.util.ValueModel;
* }
* </pre>
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/checkbox.html">Checkboxes</a>
+ * guide.</p>
*
* <p><strong>XML attributes</strong></p>
* <p>
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index 61935c2b2024..7e8532460239 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -174,7 +174,11 @@ public class CheckedTextView extends TextView implements Checkable {
int newPadding = (mCheckMarkDrawable != null) ?
mCheckMarkWidth + mBasePadding : mBasePadding;
mNeedRequestlayout |= (mPaddingRight != newPadding);
- mPaddingRight = newPadding;
+ if (isLayoutRtl()) {
+ mPaddingLeft = newPadding;
+ } else {
+ mPaddingRight = newPadding;
+ }
if (mNeedRequestlayout) {
requestLayout();
mNeedRequestlayout = false;
@@ -184,7 +188,7 @@ public class CheckedTextView extends TextView implements Checkable {
@Override
public void setPadding(int left, int top, int right, int bottom) {
super.setPadding(left, top, right, bottom);
- mBasePadding = mPaddingRight;
+ mBasePadding = getPaddingEnd();
}
@Override
@@ -213,12 +217,13 @@ public class CheckedTextView extends TextView implements Checkable {
break;
}
- int right = getWidth();
- checkMarkDrawable.setBounds(
- right - mPaddingRight,
- y,
- right - mPaddingRight + mCheckMarkWidth,
- y + height);
+ final boolean isLayoutRtl = isLayoutRtl();
+ final int width = getWidth();
+ final int top = y;
+ final int bottom = top + height;
+ final int left = isLayoutRtl ? getPaddingEnd() : width - getPaddingEnd();
+ final int right = left + mCheckMarkWidth;
+ checkMarkDrawable.setBounds(left, top, right, bottom);
checkMarkDrawable.draw(canvas);
}
}
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 108b7200f0b5..ac3bedb02d42 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -53,8 +53,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}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.
* </p>
* <p>
* For a dialog using this view, see {@link android.app.DatePickerDialog}.
diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java
index 8686177c6247..ec812143e15e 100644
--- a/core/java/android/widget/EditText.java
+++ b/core/java/android/widget/EditText.java
@@ -40,8 +40,8 @@ import android.view.accessibility.AccessibilityNodeInfo;
* EditText is a thin veneer over TextView that configures itself
* to be editable.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/text.html">Text Fields</a>
+ * guide.</p>
* <p>
* <b>XML attributes</b>
* <p>
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index f23e1aaaf47a..b6fcb03036c1 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -37,8 +37,8 @@ import android.widget.RemoteViews.RemoteView;
* A view that shows items in two-dimensional scrolling grid. The items in the
* grid come from the {@link ListAdapter} associated with this view.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-gridview.html">Grid
- * View tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/gridview.html">Grid
+ * View</a> guide.</p>
*
* @attr ref android.R.styleable#GridView_horizontalSpacing
* @attr ref android.R.styleable#GridView_verticalSpacing
diff --git a/core/java/android/widget/ImageButton.java b/core/java/android/widget/ImageButton.java
index 59a8f2804630..379354caeb0a 100644
--- a/core/java/android/widget/ImageButton.java
+++ b/core/java/android/widget/ImageButton.java
@@ -64,8 +64,8 @@ import java.util.Map;
* it will only be applied after {@code android:state_pressed} and {@code
* android:state_focused} have both evaluated false.</p>
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/button.html">Buttons</a>
+ * guide.</p>
*
* <p><strong>XML attributes</strong></p>
* <p>
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java
index 4e114d8d9b6a..ea8532503927 100644
--- a/core/java/android/widget/LinearLayout.java
+++ b/core/java/android/widget/LinearLayout.java
@@ -41,8 +41,8 @@ import android.widget.RemoteViews.RemoteView;
* {@link android.widget.LinearLayout.LayoutParams LinearLayout.LayoutParams}.
* The default orientation is horizontal.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-linearlayout.html">Linear Layout
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/linear.html">Linear Layout</a>
+ * guide.</p>
*
* <p>
* Also see {@link LinearLayout.LayoutParams android.widget.LinearLayout.LayoutParams}
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index 1d966b36c253..100b8724aade 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -1121,6 +1121,12 @@ public class ListPopupWindow {
return listContent + otherHeights;
}
+ public void setLayoutDirection(int resolvedLayoutDirection) {
+ if (mDropDownList != null) {
+ mDropDownList.setLayoutDirection(resolvedLayoutDirection);
+ }
+ }
+
/**
* <p>Wrapper class for a ListView. This wrapper can hijack the focus to
* make sure the list uses the appropriate drawables and states when
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index d2e55d905461..e011c13a9c84 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -57,8 +57,8 @@ import java.util.ArrayList;
* A view that shows items in a vertically scrolling list. The items
* come from the {@link ListAdapter} associated with this view.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-listview.html">List View
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/listview.html">List View</a>
+ * guide.</p>
*
* @attr ref android.R.styleable#ListView_entries
* @attr ref android.R.styleable#ListView_divider
diff --git a/core/java/android/widget/RadioButton.java b/core/java/android/widget/RadioButton.java
index b1bb1c06b1a1..a0fef7dafc6d 100644
--- a/core/java/android/widget/RadioButton.java
+++ b/core/java/android/widget/RadioButton.java
@@ -38,8 +38,8 @@ import com.android.internal.R;
* a radio group, checking one radio button unchecks all the others.</p>
* </p>
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/radiobutton.html">Radio Buttons</a>
+ * guide.</p>
*
* <p><strong>XML attributes</strong></p>
* <p>
diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java
index 524d27271aa2..4d3c56c1f12c 100644
--- a/core/java/android/widget/RatingBar.java
+++ b/core/java/android/widget/RatingBar.java
@@ -43,9 +43,6 @@ import com.android.internal.R;
* <p>
* The secondary progress should not be modified by the client as it is used
* internally as the background for a fractionally filled star.
- *
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
*
* @attr ref android.R.styleable#RatingBar_numStars
* @attr ref android.R.styleable#RatingBar_rating
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index d9bde109fff1..43519dfaa51b 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -56,8 +56,8 @@ import static android.util.Log.d;
* {@link #ALIGN_PARENT_BOTTOM}.
* </p>
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-relativelayout.html">Relative
- * Layout tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative
+ * Layout</a> guide.</p>
*
* <p>
* Also see {@link android.widget.RelativeLayout.LayoutParams RelativeLayout.LayoutParams} for
@@ -1306,6 +1306,21 @@ public class RelativeLayout extends ViewGroup {
mRulesChanged = true;
}
+ /**
+ * Removes a layout rule to be interpreted by the RelativeLayout.
+ *
+ * @param verb One of the verbs defined by
+ * {@link android.widget.RelativeLayout RelativeLayout}, such as
+ * ALIGN_WITH_PARENT_LEFT.
+ * @see #addRule(int)
+ * @see #addRule(int, int)
+ */
+ public void removeRule(int verb) {
+ mRules[verb] = 0;
+ mInitialRules[verb] = 0;
+ mRulesChanged = true;
+ }
+
private boolean hasRelativeRules() {
return (mInitialRules[START_OF] != 0 || mInitialRules[END_OF] != 0 ||
mInitialRules[ALIGN_START] != 0 || mInitialRules[ALIGN_END] != 0 ||
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index aa95397dfce4..f0109ce947ce 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -17,10 +17,10 @@
package android.widget;
import java.lang.ref.WeakReference;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
-
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
@@ -31,6 +31,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
+import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
@@ -47,7 +48,7 @@ import com.android.internal.widget.IRemoteViewsFactory;
public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback {
private static final String TAG = "RemoteViewsAdapter";
- // The max number of items in the cache
+ // The max number of items in the cache
private static final int sDefaultCacheSize = 40;
// The delay (in millis) to wait until attempting to unbind from a service after a request.
// This ensures that we don't stay continually bound to the service and that it can be destroyed
@@ -58,7 +59,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
private static final int sDefaultLoadingViewHeight = 50;
// Type defs for controlling different messages across the main and worker message queues
- private static final int sDefaultMessageType = 0;
+ private static final int sDefaultMessageType = 0;
private static final int sUnbindServiceMessageType = 1;
private final Context mContext;
@@ -83,6 +84,26 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
private Handler mWorkerQueue;
private Handler mMainQueue;
+ // We cache the FixedSizeRemoteViewsCaches across orientation. These are the related data
+ // structures;
+ private static final HashMap<Pair<Intent.FilterComparison, Integer>, FixedSizeRemoteViewsCache>
+ sCachedRemoteViewsCaches = new HashMap<Pair<Intent.FilterComparison, Integer>,
+ FixedSizeRemoteViewsCache>();
+ private static final HashMap<Pair<Intent.FilterComparison, Integer>, Runnable>
+ sRemoteViewsCacheRemoveRunnables = new HashMap<Pair<Intent.FilterComparison, Integer>,
+ Runnable>();
+ private static HandlerThread sCacheRemovalThread;
+ private static Handler sCacheRemovalQueue;
+
+ // We keep the cache around for a duration after onSaveInstanceState for use on re-inflation.
+ // If a new RemoteViewsAdapter with the same intent / widget id isn't constructed within this
+ // duration, the cache is dropped.
+ private static final int REMOTE_VIEWS_CACHE_DURATION = 5000;
+
+ // Used to indicate to the AdapterView that it can use this Adapter immediately after
+ // construction (happens when we have a cached FixedSizeRemoteViewsCache).
+ private boolean mDataReady = false;
+
/**
* An interface for the RemoteAdapter to notify other classes when adapters
* are actually connected to/disconnected from their actual services.
@@ -463,20 +484,18 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
private static class RemoteViewsIndexMetaData {
int typeId;
long itemId;
- boolean isRequested;
- public RemoteViewsIndexMetaData(RemoteViews v, long itemId, boolean requested) {
- set(v, itemId, requested);
+ public RemoteViewsIndexMetaData(RemoteViews v, long itemId) {
+ set(v, itemId);
}
- public void set(RemoteViews v, long id, boolean requested) {
+ public void set(RemoteViews v, long id) {
itemId = id;
if (v != null) {
typeId = v.getLayoutId();
} else {
typeId = 0;
}
- isRequested = requested;
}
}
@@ -545,10 +564,11 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
mLoadIndices = new HashSet<Integer>();
}
- public void insert(int position, RemoteViews v, long itemId, boolean isRequested) {
+ public void insert(int position, RemoteViews v, long itemId,
+ ArrayList<Integer> visibleWindow) {
// Trim the cache if we go beyond the count
if (mIndexRemoteViews.size() >= mMaxCount) {
- mIndexRemoteViews.remove(getFarthestPositionFrom(position));
+ mIndexRemoteViews.remove(getFarthestPositionFrom(position, visibleWindow));
}
// Trim the cache if we go beyond the available memory size constraints
@@ -559,15 +579,15 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
// remove based on both its position as well as it's current memory usage, as well
// as whether it was directly requested vs. whether it was preloaded by our caching
// mechanism.
- mIndexRemoteViews.remove(getFarthestPositionFrom(pruneFromPosition));
+ mIndexRemoteViews.remove(getFarthestPositionFrom(pruneFromPosition, visibleWindow));
}
// Update the metadata cache
if (mIndexMetaData.containsKey(position)) {
final RemoteViewsIndexMetaData metaData = mIndexMetaData.get(position);
- metaData.set(v, itemId, isRequested);
+ metaData.set(v, itemId);
} else {
- mIndexMetaData.put(position, new RemoteViewsIndexMetaData(v, itemId, isRequested));
+ mIndexMetaData.put(position, new RemoteViewsIndexMetaData(v, itemId));
}
mIndexRemoteViews.put(position, v);
}
@@ -610,29 +630,30 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
}
return mem;
}
- private int getFarthestPositionFrom(int pos) {
+
+ private int getFarthestPositionFrom(int pos, ArrayList<Integer> visibleWindow) {
// Find the index farthest away and remove that
int maxDist = 0;
int maxDistIndex = -1;
- int maxDistNonRequested = 0;
- int maxDistIndexNonRequested = -1;
+ int maxDistNotVisible = 0;
+ int maxDistIndexNotVisible = -1;
for (int i : mIndexRemoteViews.keySet()) {
int dist = Math.abs(i-pos);
- if (dist > maxDistNonRequested && !mIndexMetaData.get(i).isRequested) {
- // maxDistNonRequested/maxDistIndexNonRequested will store the index of the
- // farthest non-requested position
- maxDistIndexNonRequested = i;
- maxDistNonRequested = dist;
+ if (dist > maxDistNotVisible && !visibleWindow.contains(i)) {
+ // maxDistNotVisible/maxDistIndexNotVisible will store the index of the
+ // farthest non-visible position
+ maxDistIndexNotVisible = i;
+ maxDistNotVisible = dist;
}
if (dist >= maxDist) {
// maxDist/maxDistIndex will store the index of the farthest position
- // regardless of whether it was directly requested or not
+ // regardless of whether it is visible or not
maxDistIndex = i;
maxDist = dist;
}
}
- if (maxDistIndexNonRequested > -1) {
- return maxDistIndexNonRequested;
+ if (maxDistIndexNotVisible > -1) {
+ return maxDistIndexNotVisible;
}
return maxDistIndex;
}
@@ -747,11 +768,36 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
mWorkerQueue = new Handler(mWorkerThread.getLooper());
mMainQueue = new Handler(Looper.myLooper(), this);
+ if (sCacheRemovalThread == null) {
+ sCacheRemovalThread = new HandlerThread("RemoteViewsAdapter-cachePruner");
+ sCacheRemovalThread.start();
+ sCacheRemovalQueue = new Handler(sCacheRemovalThread.getLooper());
+ }
+
// Initialize the cache and the service connection on startup
- mCache = new FixedSizeRemoteViewsCache(sDefaultCacheSize);
mCallback = new WeakReference<RemoteAdapterConnectionCallback>(callback);
mServiceConnection = new RemoteViewsAdapterServiceConnection(this);
- requestBindService();
+
+ Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison, Integer>
+ (new Intent.FilterComparison(mIntent), mAppWidgetId);
+
+ synchronized(sCachedRemoteViewsCaches) {
+ if (sCachedRemoteViewsCaches.containsKey(key)) {
+ mCache = sCachedRemoteViewsCaches.get(key);
+ synchronized (mCache.mMetaData) {
+ if (mCache.mMetaData.count > 0) {
+ // As a precautionary measure, we verify that the meta data indicates a
+ // non-zero count before declaring that data is ready.
+ mDataReady = true;
+ }
+ }
+ } else {
+ mCache = new FixedSizeRemoteViewsCache(sDefaultCacheSize);
+ }
+ if (!mDataReady) {
+ requestBindService();
+ }
+ }
}
@Override
@@ -765,6 +811,51 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
}
}
+ public boolean isDataReady() {
+ return mDataReady;
+ }
+
+ public void saveRemoteViewsCache() {
+ final Pair<Intent.FilterComparison, Integer> key = new Pair<Intent.FilterComparison,
+ Integer> (new Intent.FilterComparison(mIntent), mAppWidgetId);
+
+ synchronized(sCachedRemoteViewsCaches) {
+ // If we already have a remove runnable posted for this key, remove it.
+ if (sRemoteViewsCacheRemoveRunnables.containsKey(key)) {
+ sCacheRemovalQueue.removeCallbacks(sRemoteViewsCacheRemoveRunnables.get(key));
+ sRemoteViewsCacheRemoveRunnables.remove(key);
+ }
+
+ int metaDataCount = 0;
+ int numRemoteViewsCached = 0;
+ synchronized (mCache.mMetaData) {
+ metaDataCount = mCache.mMetaData.count;
+ }
+ synchronized (mCache) {
+ numRemoteViewsCached = mCache.mIndexRemoteViews.size();
+ }
+ if (metaDataCount > 0 && numRemoteViewsCached > 0) {
+ sCachedRemoteViewsCaches.put(key, mCache);
+ }
+
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ synchronized (sCachedRemoteViewsCaches) {
+ if (sCachedRemoteViewsCaches.containsKey(key)) {
+ sCachedRemoteViewsCaches.remove(key);
+ }
+ if (sRemoteViewsCacheRemoveRunnables.containsKey(key)) {
+ sRemoteViewsCacheRemoveRunnables.remove(key);
+ }
+ }
+ }
+ };
+ sRemoteViewsCacheRemoveRunnables.put(key, r);
+ sCacheRemovalQueue.postDelayed(r, REMOTE_VIEWS_CACHE_DURATION);
+ }
+ }
+
private void loadNextIndexInBackground() {
mWorkerQueue.post(new Runnable() {
@Override
@@ -772,15 +863,13 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
if (mServiceConnection.isConnected()) {
// Get the next index to load
int position = -1;
- boolean isRequested = false;
synchronized (mCache) {
int[] res = mCache.getNextIndexToLoad();
position = res[0];
- isRequested = res[1] > 0;
}
if (position > -1) {
// Load the item, and notify any existing RemoteViewsFrameLayouts
- updateRemoteViews(position, isRequested, true);
+ updateRemoteViews(position, true);
// Queue up for the next one to load
loadNextIndexInBackground();
@@ -842,8 +931,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
}
}
- private void updateRemoteViews(final int position, boolean isRequested, boolean
- notifyWhenLoaded) {
+ private void updateRemoteViews(final int position, boolean notifyWhenLoaded) {
IRemoteViewsFactory factory = mServiceConnection.getRemoteViewsFactory();
// Load the item information from the remote service
@@ -875,13 +963,17 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
int layoutId = remoteViews.getLayoutId();
RemoteViewsMetaData metaData = mCache.getMetaData();
boolean viewTypeInRange;
+ int cacheCount;
synchronized (metaData) {
viewTypeInRange = metaData.isViewTypeInRange(layoutId);
+ cacheCount = mCache.mMetaData.count;
}
synchronized (mCache) {
if (viewTypeInRange) {
+ ArrayList<Integer> visibleWindow = getVisibleWindow(mVisibleWindowLowerBound,
+ mVisibleWindowUpperBound, cacheCount);
// Cache the RemoteViews we loaded
- mCache.insert(position, remoteViews, itemId, isRequested);
+ mCache.insert(position, remoteViews, itemId, visibleWindow);
// Notify all the views that we have previously returned for this index that
// there is new data for it.
@@ -1004,7 +1096,6 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
Context context = parent.getContext();
RemoteViews rv = mCache.getRemoteViewsAt(position);
RemoteViewsIndexMetaData indexMetaData = mCache.getMetaDataAt(position);
- indexMetaData.isRequested = true;
int typeId = indexMetaData.typeId;
try {
@@ -1103,18 +1194,21 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
// Re-request the new metadata (only after the notification to the factory)
updateTemporaryMetaData();
int newCount;
+ ArrayList<Integer> visibleWindow;
synchronized(mCache.getTemporaryMetaData()) {
newCount = mCache.getTemporaryMetaData().count;
+ visibleWindow = getVisibleWindow(mVisibleWindowLowerBound,
+ mVisibleWindowUpperBound, newCount);
}
// Pre-load (our best guess of) the views which are currently visible in the AdapterView.
// This mitigates flashing and flickering of loading views when a widget notifies that
// its data has changed.
- for (int i = mVisibleWindowLowerBound; i <= mVisibleWindowUpperBound; i++) {
+ for (int i: visibleWindow) {
// Because temporary meta data is only ever modified from this thread (ie.
// mWorkerThread), it is safe to assume that count is a valid representation.
if (i < newCount) {
- updateRemoteViews(i, false, false);
+ updateRemoteViews(i, false);
}
}
@@ -1135,6 +1229,31 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
mNotifyDataSetChangedAfterOnServiceConnected = false;
}
+ private ArrayList<Integer> getVisibleWindow(int lower, int upper, int count) {
+ ArrayList<Integer> window = new ArrayList<Integer>();
+
+ // In the case that the window is invalid or uninitialized, return an empty window.
+ if ((lower == 0 && upper == 0) || lower < 0 || upper < 0) {
+ return window;
+ }
+
+ if (lower <= upper) {
+ for (int i = lower; i <= upper; i++){
+ window.add(i);
+ }
+ } else {
+ // If the upper bound is less than the lower bound it means that the visible window
+ // wraps around.
+ for (int i = lower; i < count; i++) {
+ window.add(i);
+ }
+ for (int i = 0; i <= upper; i++) {
+ window.add(i);
+ }
+ }
+ return window;
+ }
+
public void notifyDataSetChanged() {
// Dequeue any unbind messages
mMainQueue.removeMessages(sUnbindServiceMessageType);
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index c44ce8a8cff0..a30567fa1d57 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -326,7 +326,6 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
int oldLeft, int oldTop, int oldRight, int oldBottom) {
adjustDropDownSizeAndPosition();
}
-
});
}
@@ -1285,15 +1284,22 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
Resources res = getContext().getResources();
int anchorPadding = mSearchPlate.getPaddingLeft();
Rect dropDownPadding = new Rect();
+ final boolean isLayoutRtl = isLayoutRtl();
int iconOffset = mIconifiedByDefault
? res.getDimensionPixelSize(R.dimen.dropdownitem_icon_width)
+ res.getDimensionPixelSize(R.dimen.dropdownitem_text_padding_left)
: 0;
mQueryTextView.getDropDownBackground().getPadding(dropDownPadding);
- mQueryTextView.setDropDownHorizontalOffset(-(dropDownPadding.left + iconOffset)
- + anchorPadding);
- mQueryTextView.setDropDownWidth(mDropDownAnchor.getWidth() + dropDownPadding.left
- + dropDownPadding.right + iconOffset - (anchorPadding));
+ int offset;
+ if (isLayoutRtl) {
+ offset = - dropDownPadding.left;
+ } else {
+ offset = anchorPadding - (dropDownPadding.left + iconOffset);
+ }
+ mQueryTextView.setDropDownHorizontalOffset(offset);
+ final int width = mDropDownAnchor.getWidth() + dropDownPadding.left
+ + dropDownPadding.right + iconOffset - anchorPadding;
+ mQueryTextView.setDropDownWidth(width);
}
}
@@ -1347,6 +1353,11 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
}
};
+ @Override
+ public void onResolvedLayoutDirectionChanged() {
+ mQueryTextView.setLayoutDirection(getResolvedLayoutDirection());
+ }
+
/**
* Query rewriting.
*/
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index 510a7940e9f5..ecd7277a04ba 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -39,10 +39,16 @@ import android.view.accessibility.AccessibilityNodeInfo;
* The items in the Spinner come from the {@link Adapter} associated with
* this view.
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-spinner.html">Spinner
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/spinner.html">Spinners</a> guide.</p>
*
+ * @attr ref android.R.styleable#Spinner_dropDownHorizontalOffset
+ * @attr ref android.R.styleable#Spinner_dropDownSelector
+ * @attr ref android.R.styleable#Spinner_dropDownVerticalOffset
+ * @attr ref android.R.styleable#Spinner_dropDownWidth
+ * @attr ref android.R.styleable#Spinner_gravity
+ * @attr ref android.R.styleable#Spinner_popupBackground
* @attr ref android.R.styleable#Spinner_prompt
+ * @attr ref android.R.styleable#Spinner_spinnerMode
*/
@Widget
public class Spinner extends AbsSpinner implements OnClickListener {
@@ -409,6 +415,7 @@ public class Spinner extends AbsSpinner implements OnClickListener {
/**
* <p>A spinner does not support item click events. Calling this method
* will raise an exception.</p>
+ * <p>Instead use {@link AdapterView#setOnItemSelectedListener}.
*
* @param l this listener will be ignored
*/
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 8f5dc2ce2be5..5d6491d31f46 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -53,6 +53,17 @@ import com.android.internal.R;
* {@link #setSwitchTextAppearance(android.content.Context, int) switchTextAppearance} and
* the related seSwitchTypeface() methods control that of the thumb.
*
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/togglebutton.html">Toggle Buttons</a>
+ * guide.</p>
+ *
+ * @attr ref android.R.styleable#Switch_textOn
+ * @attr ref android.R.styleable#Switch_textOff
+ * @attr ref android.R.styleable#Switch_switchMinWidth
+ * @attr ref android.R.styleable#Switch_switchPadding
+ * @attr ref android.R.styleable#Switch_switchTextAppearance
+ * @attr ref android.R.styleable#Switch_thumb
+ * @attr ref android.R.styleable#Switch_thumbTextPadding
+ * @attr ref android.R.styleable#Switch_track
*/
public class Switch extends CompoundButton {
private static final int TOUCH_MODE_IDLE = 0;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 25f01319ea54..5be9899f29bc 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4837,18 +4837,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
canvas.translate(compoundPaddingLeft, extendedPaddingTop + voffsetText);
+ final boolean isLayoutRtl = isLayoutRtl();
+
final int layoutDirection = getResolvedLayoutDirection();
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
if (mEllipsize == TextUtils.TruncateAt.MARQUEE &&
mMarqueeFadeMode != MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {
if (!mSingleLine && getLineCount() == 1 && canMarquee() &&
(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) != Gravity.LEFT) {
- canvas.translate(mLayout.getLineRight(0) - (mRight - mLeft -
- getCompoundPaddingLeft() - getCompoundPaddingRight()), 0.0f);
+ final int width = mRight - mLeft;
+ final int padding = getCompoundPaddingLeft() + getCompoundPaddingRight();
+ final float dx = mLayout.getLineRight(0) - (width - padding);
+ canvas.translate(isLayoutRtl ? -dx : +dx, 0.0f);
}
if (mMarquee != null && mMarquee.isRunning()) {
- canvas.translate(-mMarquee.mScroll, 0.0f);
+ final float dx = -mMarquee.getScroll();
+ canvas.translate(isLayoutRtl ? -dx : +dx, 0.0f);
}
}
@@ -4862,7 +4867,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
if (mMarquee != null && mMarquee.shouldDrawGhost()) {
- canvas.translate((int) mMarquee.getGhostOffset(), 0.0f);
+ final int dx = (int) mMarquee.getGhostOffset();
+ canvas.translate(isLayoutRtl ? -dx : dx, 0.0f);
layout.draw(canvas, highlight, mHighlightPaint, cursorOffsetVertical);
}
@@ -7455,7 +7461,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (mMarquee != null && !mMarquee.isStopped()) {
final Marquee marquee = mMarquee;
if (marquee.shouldDrawLeftFade()) {
- return marquee.mScroll / getHorizontalFadingEdgeLength();
+ final float scroll = marquee.getScroll();
+ return scroll / getHorizontalFadingEdgeLength();
} else {
return 0.0f;
}
@@ -7483,7 +7490,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
mMarqueeFadeMode != MARQUEE_FADE_SWITCH_SHOW_ELLIPSIS) {
if (mMarquee != null && !mMarquee.isStopped()) {
final Marquee marquee = mMarquee;
- return (marquee.mMaxFadeScroll - marquee.mScroll) / getHorizontalFadingEdgeLength();
+ final float maxFadeScroll = marquee.getMaxFadeScroll();
+ final float scroll = marquee.getScroll();
+ return (maxFadeScroll - scroll) / getHorizontalFadingEdgeLength();
} else if (getLineCount() == 1) {
final int layoutDirection = getResolvedLayoutDirection();
final int absoluteGravity = Gravity.getAbsoluteGravity(mGravity, layoutDirection);
@@ -8577,13 +8586,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
private byte mStatus = MARQUEE_STOPPED;
private final float mScrollUnit;
private float mMaxScroll;
- float mMaxFadeScroll;
+ private float mMaxFadeScroll;
private float mGhostStart;
private float mGhostOffset;
private float mFadeStop;
private int mRepeatLimit;
- float mScroll;
+ private float mScroll;
Marquee(TextView v) {
final float density = v.getContext().getResources().getDisplayMetrics().density;
@@ -8675,6 +8684,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return mGhostOffset;
}
+ float getScroll() {
+ return mScroll;
+ }
+
+ float getMaxFadeScroll() {
+ return mMaxFadeScroll;
+ }
+
boolean shouldDrawLeftFade() {
return mScroll <= mFadeStop;
}
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 18f7a916d680..cb9ed619613c 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -48,8 +48,8 @@ import java.util.Locale;
* or 'P' to pick. For a dialog using this view, see
* {@link android.app.TimePickerDialog}.
*<p>
- * See the <a href="{@docRoot}resources/tutorials/views/hello-timepicker.html">Time Picker
- * tutorial</a>.
+ * See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
+ * guide.
* </p>
*/
@Widget
diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java
index 4beee96ef54d..cedc7772cb21 100644
--- a/core/java/android/widget/ToggleButton.java
+++ b/core/java/android/widget/ToggleButton.java
@@ -31,8 +31,8 @@ import com.android.internal.R;
* Displays checked/unchecked states as a button
* with a "light" indicator and by default accompanied with the text "ON" or "OFF".
*
- * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff
- * tutorial</a>.</p>
+ * <p>See the <a href="{@docRoot}guide/topics/ui/controls/togglebutton.html">Toggle Buttons</a>
+ * guide.</p>
*
* @attr ref android.R.styleable#ToggleButton_textOn
* @attr ref android.R.styleable#ToggleButton_textOff
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 42bc14d3ab22..4656b8baa620 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -87,7 +87,7 @@ public final class BatteryStatsImpl extends BatteryStats {
private static final int MAGIC = 0xBA757475; // 'BATSTATS'
// Current on-disk Parcel version
- private static final int VERSION = 61 + (USE_OLD_HISTORY ? 1000 : 0);
+ private static final int VERSION = 62 + (USE_OLD_HISTORY ? 1000 : 0);
// Maximum number of items we will record in the history.
private static final int MAX_HISTORY_ITEMS = 2000;
@@ -2681,9 +2681,12 @@ public final class BatteryStatsImpl extends BatteryStats {
if (mUserActivityCounters == null) {
initUserActivityLocked();
}
- if (type < 0) type = 0;
- else if (type >= NUM_USER_ACTIVITY_TYPES) type = NUM_USER_ACTIVITY_TYPES-1;
- mUserActivityCounters[type].stepAtomic();
+ if (type >= 0 && type < NUM_USER_ACTIVITY_TYPES) {
+ mUserActivityCounters[type].stepAtomic();
+ } else {
+ Slog.w(TAG, "Unknown user activity type " + type + " was specified.",
+ new Throwable());
+ }
}
@Override
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index e429ffcc623d..b1423ca7f7f2 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -44,7 +44,6 @@ LOCAL_SRC_FILES:= \
android_database_SQLiteGlobal.cpp \
android_database_SQLiteDebug.cpp \
android_emoji_EmojiFactory.cpp \
- android_view_Display.cpp \
android_view_DisplayEventReceiver.cpp \
android_view_Surface.cpp \
android_view_TextureView.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index f0dd32165d24..c936b0bb68b8 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -116,7 +116,6 @@ extern int register_android_graphics_Region(JNIEnv* env);
extern int register_android_graphics_SurfaceTexture(JNIEnv* env);
extern int register_android_graphics_Xfermode(JNIEnv* env);
extern int register_android_graphics_PixelFormat(JNIEnv* env);
-extern int register_android_view_Display(JNIEnv* env);
extern int register_android_view_DisplayEventReceiver(JNIEnv* env);
extern int register_android_view_GLES20DisplayList(JNIEnv* env);
extern int register_android_view_GLES20Canvas(JNIEnv* env);
@@ -1088,7 +1087,6 @@ static const RegJNIRec gRegJNI[] = {
REG_JNI(register_android_os_SystemProperties),
REG_JNI(register_android_os_Binder),
REG_JNI(register_android_os_Parcel),
- REG_JNI(register_android_view_Display),
REG_JNI(register_android_view_DisplayEventReceiver),
REG_JNI(register_android_nio_utils),
REG_JNI(register_android_graphics_PixelFormat),
diff --git a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
index 6ce3f51925ac..aa4cbde2f7ca 100644
--- a/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
+++ b/core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp
@@ -164,7 +164,7 @@ SkStream* CreateJavaInputStreamAdaptor(JNIEnv* env, jobject stream,
RETURN_NULL_IF_NULL(gInputStream_resetMethodID);
RETURN_NULL_IF_NULL(gInputStream_markMethodID);
RETURN_NULL_IF_NULL(gInputStream_availableMethodID);
- RETURN_NULL_IF_NULL(gInputStream_availableMethodID);
+ RETURN_NULL_IF_NULL(gInputStream_readMethodID);
RETURN_NULL_IF_NULL(gInputStream_skipMethodID);
gInited = true;
diff --git a/core/jni/android_view_Display.cpp b/core/jni/android_view_Display.cpp
deleted file mode 100644
index aedf1e42cf73..000000000000
--- a/core/jni/android_view_Display.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <cutils/properties.h>
-
-#include <gui/SurfaceComposerClient.h>
-#include <ui/PixelFormat.h>
-#include <ui/DisplayInfo.h>
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include <android_runtime/AndroidRuntime.h>
-#include <utils/misc.h>
-#include <utils/Log.h>
-#include <cutils/properties.h>
-
-// ----------------------------------------------------------------------------
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-struct offsets_t {
- jfieldID display;
- jfieldID pixelFormat;
- jfieldID fps;
- jfieldID density;
- jfieldID xdpi;
- jfieldID ydpi;
-};
-static offsets_t offsets;
-static bool headless = false;
-
-// ----------------------------------------------------------------------------
-
-static void android_view_Display_init(
- JNIEnv* env, jobject clazz, jint dpy)
-{
- DisplayInfo info;
- if (headless) {
- // initialize dummy display with reasonable values
- info.pixelFormatInfo.format = 1; // RGB_8888
- info.fps = 60;
- info.density = 160;
- info.xdpi = 160;
- info.ydpi = 160;
- } else {
- status_t err = SurfaceComposerClient::getDisplayInfo(DisplayID(dpy), &info);
- if (err < 0) {
- jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
- return;
- }
- }
- env->SetIntField(clazz, offsets.pixelFormat,info.pixelFormatInfo.format);
- env->SetFloatField(clazz, offsets.fps, info.fps);
- env->SetFloatField(clazz, offsets.density, info.density);
- env->SetFloatField(clazz, offsets.xdpi, info.xdpi);
- env->SetFloatField(clazz, offsets.ydpi, info.ydpi);
-}
-
-static jint android_view_Display_getRawWidthNative(
- JNIEnv* env, jobject clazz)
-{
- if (headless) return 640;
- DisplayID dpy = env->GetIntField(clazz, offsets.display);
- return SurfaceComposerClient::getDisplayWidth(dpy);
-}
-
-static jint android_view_Display_getRawHeightNative(
- JNIEnv* env, jobject clazz)
-{
- if (headless) return 480;
- DisplayID dpy = env->GetIntField(clazz, offsets.display);
- return SurfaceComposerClient::getDisplayHeight(dpy);
-}
-
-static jint android_view_Display_getOrientation(
- JNIEnv* env, jobject clazz)
-{
- if (headless) return 0; // Surface.ROTATION_0
- DisplayID dpy = env->GetIntField(clazz, offsets.display);
- return SurfaceComposerClient::getDisplayOrientation(dpy);
-}
-
-static jint android_view_Display_getDisplayCount(
- JNIEnv* env, jclass clazz)
-{
- if (headless) return 1;
- return SurfaceComposerClient::getNumberOfDisplays();
-}
-
-// ----------------------------------------------------------------------------
-
-const char* const kClassPathName = "android/view/Display";
-
-static void nativeClassInit(JNIEnv* env, jclass clazz);
-
-static JNINativeMethod gMethods[] = {
- { "nativeClassInit", "()V",
- (void*)nativeClassInit },
- { "getDisplayCount", "()I",
- (void*)android_view_Display_getDisplayCount },
- { "init", "(I)V",
- (void*)android_view_Display_init },
- { "getRawWidthNative", "()I",
- (void*)android_view_Display_getRawWidthNative },
- { "getRawHeightNative", "()I",
- (void*)android_view_Display_getRawHeightNative },
- { "getOrientation", "()I",
- (void*)android_view_Display_getOrientation }
-};
-
-void nativeClassInit(JNIEnv* env, jclass clazz)
-{
- char value[PROPERTY_VALUE_MAX];
-
- property_get("ro.config.headless", value, "0");
- if (strcmp(value, "1") == 0)
- headless = true;
-
- offsets.display = env->GetFieldID(clazz, "mDisplay", "I");
- offsets.pixelFormat = env->GetFieldID(clazz, "mPixelFormat", "I");
- offsets.fps = env->GetFieldID(clazz, "mRefreshRate", "F");
- offsets.density = env->GetFieldID(clazz, "mDensity", "F");
- offsets.xdpi = env->GetFieldID(clazz, "mDpiX", "F");
- offsets.ydpi = env->GetFieldID(clazz, "mDpiY", "F");
-}
-
-int register_android_view_Display(JNIEnv* env)
-{
- return AndroidRuntime::registerNativeMethods(env,
- kClassPathName, gMethods, NELEM(gMethods));
-}
-
-};
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index ade3180bb4b8..9fc73a4f15fa 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -531,7 +531,7 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
jfloat totalAdvance = value->getTotalAdvance();
const float* positions = value->getPos();
int bytesCount = glyphsCount * sizeof(jchar);
- renderer->drawGeneralText((const char*) glyphs, bytesCount, glyphsCount, x, y,
+ renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y,
positions, paint, totalAdvance);
}
@@ -562,7 +562,7 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text,
jfloat totalAdvance = value->getTotalAdvance();
const float* positions = value->getPos();
int bytesCount = glyphsCount * sizeof(jchar);
- renderer->drawGeneralText((const char*) glyphs, bytesCount, glyphsCount, x, y,
+ renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y,
positions, paint, totalAdvance);
}
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 60f8c48a64d4..3cd28b113a72 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -473,9 +473,9 @@ static void Surface_closeTransaction(
}
static void Surface_setOrientation(
- JNIEnv* env, jobject clazz, jint display, jint orientation, jint flags)
+ JNIEnv* env, jobject clazz, jint display, jint orientation)
{
- int err = SurfaceComposerClient::setOrientation(display, orientation, flags);
+ int err = SurfaceComposerClient::setOrientation(display, orientation, 0);
if (err < 0) {
doThrowIAE(env);
}
@@ -839,7 +839,7 @@ static JNINativeMethod gSurfaceMethods[] = {
{"unlockCanvas", "(Landroid/graphics/Canvas;)V", (void*)Surface_unlockCanvas },
{"openTransaction", "()V", (void*)Surface_openTransaction },
{"closeTransaction", "()V", (void*)Surface_closeTransaction },
- {"setOrientation", "(III)V", (void*)Surface_setOrientation },
+ {"setOrientation", "(II)V", (void*)Surface_setOrientation },
{"screenshot", "(II)Landroid/graphics/Bitmap;", (void*)Surface_screenshotAll },
{"screenshot", "(IIII)Landroid/graphics/Bitmap;", (void*)Surface_screenshot },
{"setLayer", "(I)V", (void*)Surface_setLayer },
diff --git a/core/res/res/values-mcc208-mnc01/config.xml b/core/res/res/values-mcc208-mnc01/config.xml
new file mode 100755
index 000000000000..c1489b199eb5
--- /dev/null
+++ b/core/res/res/values-mcc208-mnc01/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Orange Internet,orange.fr,,,,,,orange,orange,,208,01,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc214-mnc03/config.xml b/core/res/res/values-mcc214-mnc03/config.xml
new file mode 100755
index 000000000000..02f1475acfad
--- /dev/null
+++ b/core/res/res/values-mcc214-mnc03/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Orange Internet PC,internet,,,,,,orange,orange,,214,03,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc214-mnc07/config.xml b/core/res/res/values-mcc214-mnc07/config.xml
new file mode 100755
index 000000000000..4e3fa162cf62
--- /dev/null
+++ b/core/res/res/values-mcc214-mnc07/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Conexión compartida,movistar.es,,,,,,MOVISTAR,MOVISTAR,,214,07,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc222-mnc01/config.xml b/core/res/res/values-mcc222-mnc01/config.xml
new file mode 100755
index 000000000000..6bb1196b5775
--- /dev/null
+++ b/core/res/res/values-mcc222-mnc01/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">TIM WEB,ibox.tim.it,,,,,,,,,222,01,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc222-mnc10/config.xml b/core/res/res/values-mcc222-mnc10/config.xml
new file mode 100755
index 000000000000..24dd71cea13f
--- /dev/null
+++ b/core/res/res/values-mcc222-mnc10/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Tethering Internet,web.omnitel.it,,,,,,,,,222,10,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc234-mnc33/config.xml b/core/res/res/values-mcc234-mnc33/config.xml
new file mode 100755
index 000000000000..d79d212959f0
--- /dev/null
+++ b/core/res/res/values-mcc234-mnc33/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Consumer Broadband,consumerbroadband,,,,,,,,,234,33,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc302-mnc370/config.xml b/core/res/res/values-mcc302-mnc370/config.xml
new file mode 100755
index 000000000000..b1d363fac070
--- /dev/null
+++ b/core/res/res/values-mcc302-mnc370/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Fido Tethering,isp.fido.apn,,,,,,,,,302,370,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc302-mnc660/config.xml b/core/res/res/values-mcc302-mnc660/config.xml
new file mode 100755
index 000000000000..37853cf88f92
--- /dev/null
+++ b/core/res/res/values-mcc302-mnc660/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">MTS -Tethering,internet.mts,,,,,,,,,302,660,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc302-mnc720/config.xml b/core/res/res/values-mcc302-mnc720/config.xml
new file mode 100755
index 000000000000..40ef9391ffd8
--- /dev/null
+++ b/core/res/res/values-mcc302-mnc720/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Rogers Tethering,isp.apn,,,,,,,,,302,720,,DUN</string>
+</resources>
diff --git a/core/res/res/values-mcc340-mnc01/config.xml b/core/res/res/values-mcc340-mnc01/config.xml
new file mode 100755
index 000000000000..fb71f3bc894b
--- /dev/null
+++ b/core/res/res/values-mcc340-mnc01/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+ for different hardware and product builds. Do not translate. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
+ <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+ <!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+ <integer-array translatable="false" name="config_tether_upstream_types">
+ <item>1</item>
+ <item>4</item>
+ <item>7</item>
+ <item>9</item>
+ </integer-array>
+
+ <!-- String containing the apn value for tethering. May be overriden by secure settings
+ TETHER_DUN_APN. Value is a comma separated series of strings:
+ "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
+ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
+ <string translatable="false" name="config_tether_apndata">Orangeweb,orangeweb,,,,,,orange,orange,,340,01,1,DUN</string>
+</resources>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index c6c4d5f09265..04765cf948f4 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -824,7 +824,7 @@
<string name="searchview_description_query" msgid="5911778593125355124">"Zoekopdracht"</string>
<string name="searchview_description_clear" msgid="1330281990951833033">"Zoekopdracht wissen"</string>
<string name="searchview_description_submit" msgid="2688450133297983542">"Zoekopdracht verzenden"</string>
- <string name="searchview_description_voice" msgid="2453203695674994440">"Spraakgestuurd zoeken"</string>
+ <string name="searchview_description_voice" msgid="2453203695674994440">"Gesproken zoekopdrachten"</string>
<string name="enable_explore_by_touch_warning_title" msgid="7460694070309730149">"\'Verkennen via aanraking\' aan?"</string>
<string name="enable_explore_by_touch_warning_message" product="tablet" msgid="8655887539089910577">"<xliff:g id="ACCESSIBILITY_SERVICE_NAME">%1$s</xliff:g> wil \'Verkennen via aanraking\' inschakelen. Wanneer \'Verkennen via aanraking\' is ingeschakeld, kunt u beschrijvingen beluisteren of bekijken van wat er onder uw vinger staat of aanraakbewerkingen uitvoeren op de tablet."</string>
<string name="enable_explore_by_touch_warning_message" product="default" msgid="2708199672852373195">"<xliff:g id="ACCESSIBILITY_SERVICE_NAME">%1$s</xliff:g> wil \'Verkennen via aanraking\' inschakelen. Wanneer \'Verkennen via aanraking\' is ingeschakeld, kunt u beschrijvingen beluisteren of bekijken van wat er onder uw vinger staat of aanraakbewerkingen uitvoeren op de telefoon."</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 50670fe6758a..270998f5d87e 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -699,7 +699,7 @@
<string name="lockscreen_emergency_call" msgid="5347633784401285225">"Экстренный вызов"</string>
<string name="lockscreen_return_to_call" msgid="5244259785500040021">"Вернуться к вызову"</string>
<string name="lockscreen_pattern_correct" msgid="9039008650362261237">"Правильно!"</string>
- <string name="lockscreen_pattern_wrong" msgid="4317955014948108794">"Повторить попытку"</string>
+ <string name="lockscreen_pattern_wrong" msgid="4317955014948108794">"Повторите попытку"</string>
<string name="lockscreen_password_wrong" msgid="5737815393253165301">"Повторить попытку"</string>
<string name="faceunlock_multiple_failures" msgid="754137583022792429">"Все попытки войти с помощью Фейсконтроля использованы"</string>
<string name="lockscreen_plugged_in" msgid="8057762828355572315">"Идет зарядка (<xliff:g id="NUMBER">%d</xliff:g><xliff:g id="PERCENT">%%</xliff:g>)"</string>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 59cdab140c1b..7c9a500abe96 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -245,7 +245,7 @@
<string name="permdesc_retrieve_window_content" msgid="3193269069469700265">"Ivumela insiza ukuthi ithole okuqukethe kwi-Window. Izinsiza ezinobungozi zingathola kabush iwindi eliphelele bese ibheka konke okuqukethwe ngaphandle kwaaaphasiwedi."</string>
<string name="permlab_retrieve_window_info" msgid="8532295199112519378">"buyisa ulwazi lewindi"</string>
<string name="permdesc_retrieve_window_info" msgid="4998836370424186849">"Ivumela uhlelo lokusebenza ukubuyisa ulwazi mayelana namawindi avela kumphathi wewindi. Izinhlelo zokusebenza zingabuyisa ulwazi olubhekiswe ukusetshenziselwa kohlelo lwangaphakathi."</string>
- <string name="permlab_filter_events" msgid="8675535648807427389">"hlunga izehlakalo"</string>
+ <string name="permlab_filter_events" msgid="8675535648807427389">"hlunga imicimbi"</string>
<string name="permdesc_filter_events" msgid="8006236315888347680">"Ivumela uhlelo lokusebenza ukubhalisa isihlungi sokufaka ukusakaza kwazo zonke izehlakalo zomsebenzisi ngaphambi kokuthunyelwa. Izinhlelo zokusebenza zingalawula i-UI yohlelo ngaphandle kokungena komsebenzisi."</string>
<string name="permlab_shutdown" msgid="7185747824038909016">"ukuvala shaqa kwengxenye"</string>
<string name="permdesc_shutdown" msgid="7046500838746291775">"Ibeka imeneja yomsebenzi kwisimo sokuvala shaqa. Ayenzi ukuvala shaqa okuphelele."</string>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 23c078f1c97d..39129e5dfe41 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -254,8 +254,11 @@
<!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
<!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
<integer-array translatable="false" name="config_tether_upstream_types">
+ <item>0</item>
<item>1</item>
- <item>4</item>
+ <item>5</item>
+ <item>7</item>
+ <item>9</item>
</integer-array>
<!-- If the DUN connection for this CDMA device supports more than just DUN -->
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 9c12263a09b7..2f93335664d9 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -1430,6 +1430,9 @@ please see themes_device_defaults.xml.
<item name="preferenceLayoutChild">@android:layout/preference_child_holo</item>
<item name="detailsElementBackground">@android:drawable/panel_bg_holo_light</item>
+ <!-- PreferenceFrameLayout attributes -->
+ <item name="preferenceFrameLayoutStyle">@android:style/Widget.Holo.PreferenceFrameLayout</item>
+
<!-- Search widget styles -->
<item name="searchWidgetCorpusItemBackground">@android:color/search_widget_corpus_item_background</item>
diff --git a/docs/html/distribute/googleplay/about/monetizing.jd b/docs/html/distribute/googleplay/about/monetizing.jd
index 2fa2da891640..4980edaecbbe 100644
--- a/docs/html/distribute/googleplay/about/monetizing.jd
+++ b/docs/html/distribute/googleplay/about/monetizing.jd
@@ -42,7 +42,7 @@ manages the application download.</p>
<h3 id="payment-methods">Convenient payment options</h3>
<p>Users can purchase your products on Google Play using several convenient
-payment methods&mdash;credit cards, Direct Carrier Billing, and Google Play balance..</p>
+payment methods&mdash;credit cards, Direct Carrier Billing, and Google Play balance.</p>
<p><span style="font-weight:500">Credit card</span> is the most common method of payment. Users can pay using any credit card
that they’ve registered in Google Play. To make it easy for users to get started,
diff --git a/docs/html/guide/components/fragments.jd b/docs/html/guide/components/fragments.jd
index 938e0ab02ea6..4f620339355a 100644
--- a/docs/html/guide/components/fragments.jd
+++ b/docs/html/guide/components/fragments.jd
@@ -709,6 +709,12 @@ href="{@docRoot}guide/components/activities.html#Lifecycle">managing the activit
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>
+<p class="caution"><strong>Caution:</strong> If you need a {@link android.content.Context} object
+within your {@link android.app.Fragment}, you can call {@link android.app.Fragment#getActivity()}.
+However, be careful to call {@link android.app.Fragment#getActivity()} only when the fragment is
+attached to an activity. When the fragment is not yet attached, or was detached during the end of
+its lifecycle, {@link android.app.Fragment#getActivity()} will return null.</p>
+
<h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3>
diff --git a/docs/html/guide/google/gcm/gcm.jd b/docs/html/guide/google/gcm/gcm.jd
index 1b95520bf78f..0b05c5358bf0 100644
--- a/docs/html/guide/google/gcm/gcm.jd
+++ b/docs/html/guide/google/gcm/gcm.jd
@@ -56,7 +56,7 @@ page.title=GCM Architectural Overview
</div>
</div>
-<p>Google Cloud Messaging for Android (GCM) is a service that helps
+<p>Google Cloud Messaging for Android (GCM) is a free service that helps
developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of
messages and delivery to the target Android application running on the target
device.</p>
@@ -545,7 +545,8 @@ private void handleRegistration(Intent intent) {
<p>The <code>com.google.android.c2dm.intent.RECEIVE</code> intent is used by GCM to
deliver the messages sent by the 3rd-party server to the application running in the device.
If the server included key-pair values in the <code>data</code> parameter, they are available as
-extras in this intent, with the keys being the extra names.
+extras in this intent, with the keys being the extra names. GCM also includes an extra called
+<code>from</code> which contains the sender ID as an string.
<p>Here is an example, again using the <code>MyIntentReceiver</code> class:</p>
@@ -652,7 +653,7 @@ message sent by the application server. See <a href="adv.html#collapsible">Advan
<td><code>data</code></td>
<td>A JSON object whose fields represents the key-value pairs of the message's payload data. If present, the payload data it will be
included in the Intent as application data, with the key being the extra's name. For instance, <code>"data":{"score":"3x1"}</code> would result in an intent extra named <code>score</code> whose value is the string <code>3x1</code>.
-There is no limit on the number of key/value pairs, though there is a limit on the total size of the message (4kb). Note that the values <em>must be enclosed by strings</em>. If you want to include objects or other non-string data types (such as integers or booleans), you have to do the conversion to string yourself. Optional.</td>
+There is no limit on the number of key/value pairs, though there is a limit on the total size of the message (4kb). Note that the values <em>must be enclosed by strings</em>. If you want to include objects or other non-string data types (such as integers or booleans), you have to do the conversion to string yourself. Also note that the key cannot be a reserved word ("from" or any word starting with "google."). Optional.</td>
</tr>
<tr>
<td><code>delay_while_idle</code></td>
@@ -683,7 +684,7 @@ sent. Optional. The default value is <code>false</code>, and must be a JSON bool
</tr>
<tr>
<td><code>data.&lt;key&gt;</code></td>
- <td>Payload data, expressed as parameters prefixed with <code>data.</code> and suffixed as the key. For instance, a parameter of <code>data.score=3x1</code> would result in an intent extra named <code>score</code> whose value is the string <code>3x1</code>. There is no limit on the number of key/value parameters, though there is a limit on the total size of the message. Optional.</td>
+ <td>Payload data, expressed as parameters prefixed with <code>data.</code> and suffixed as the key. For instance, a parameter of <code>data.score=3x1</code> would result in an intent extra named <code>score</code> whose value is the string <code>3x1</code>. There is no limit on the number of key/value parameters, though there is a limit on the total size of the message. Note that the key cannot be a reserved word ("from" or any word starting with "google."). Optional.</td>
</tr>
<tr>
<td><code>delay_while_idle</code></td>
@@ -879,8 +880,20 @@ messages.
<li>Request originated from a server not whitelisted in the Server Key IPs.</li>
</ul>
-Check that the token you're sending inside the <code>Authorization</code> header is the correct API key associated with your project.<br/>
+Check that the token you're sending inside the <code>Authorization</code> header is the correct API key associated with your project. You can check the validity of your API key by running the following command:<br/>
+<pre># api_key=YOUR_API_KEY
+
+# curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}"</pre>
+
+
+If you receive a 401 HTTP status code, your API key is not valid. Otherwise you should see something like this:<br/>
+
+<pre>
+{"multicast_id":6782339717028231855,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
+</pre>
+If you want to confirm the validity of a registration ID, you can do so by replacing "ABC" with the registration ID.
+<br/>
Happens when the HTTP status code is 401.
<dt id="timeout"><strong>Timeout</strong></dt>
@@ -974,7 +987,7 @@ registration_id=32
<p>To view statistics and any error messages for your GCM applications:</p>
<ol>
- <li> Go to <code><a href="http://play.google.com/apps/publish">play.google.com/apps/publish</a></code>.</li>
+ <li> Go to the <code><a href="http://play.google.com/apps/publish">Android Developer Console</a></code>.</li>
<li>Login with your developer account.
<p>You will see a page that has a list of all of your apps.</p></li>
<li> Click on the &quot;statistics&quot; link next to the app for which you want to view GCM stats.
@@ -982,6 +995,8 @@ registration_id=32
<li>Go to the drop-down menu and select the GCM metric you want to view.
</li>
</ol>
+<p class="note"><strong>Note:</strong> Stats on the Google API Console are not enabled for GCM. You must use the <a href="http://play.google.com/apps/publish">Android Developer Console</a>.</p>
+
<h2 id="example">Examples</h2>
<p>See the <a href="demo.html">GCM Demo Application</a> document.</p>
diff --git a/docs/html/guide/google/gcm/index.jd b/docs/html/guide/google/gcm/index.jd
index 140b0762967a..8079ebae6e2c 100644
--- a/docs/html/guide/google/gcm/index.jd
+++ b/docs/html/guide/google/gcm/index.jd
@@ -5,6 +5,8 @@ page.title=Google Cloud Messaging for Android
<p><img src="{@docRoot}images/gcm/gcm-logo.png" /></p>
<p>Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device.</p>
+<p>GCM is completely free no matter how big your messaging needs are, and there are no quotas.</p>
+
<p>To learn more about GCM, you can join the <a href="https://groups.google.com/forum/?fromgroups#!forum/android-gcm">android-gcm group</a> and read the following documents:</p>
<dl>
diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs
index 94b9773474ba..9465f1882a06 100644
--- a/docs/html/guide/guide_toc.cs
+++ b/docs/html/guide/guide_toc.cs
@@ -197,6 +197,9 @@
<li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html">
<span class="en">Action Bar</span>
</a></li>
+ <li><a href="<?cs var:toroot ?>guide/topics/ui/settings.html">
+ <span class="en">Settings</span>
+ </a></li>
<li class="nav-section">
<div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html">
<span class="en">Notifications</span>
diff --git a/docs/html/guide/topics/ui/controls/checkbox.jd b/docs/html/guide/topics/ui/controls/checkbox.jd
index 35b8f560b15c..ea70980ba096 100644
--- a/docs/html/guide/topics/ui/controls/checkbox.jd
+++ b/docs/html/guide/topics/ui/controls/checkbox.jd
@@ -65,7 +65,7 @@ click event for both checkboxes:</p>
<pre>
public void onCheckboxClicked(View view) {
// Is the view now checked?
- boolean checked = (CheckBox) view).isChecked();
+ boolean checked = ((CheckBox) view).isChecked();
// Check which checkbox was clicked
switch(view.getId()) {
diff --git a/docs/html/guide/topics/ui/declaring-layout.jd b/docs/html/guide/topics/ui/declaring-layout.jd
index 3c9faa8b2cee..e971a752c4e4 100644
--- a/docs/html/guide/topics/ui/declaring-layout.jd
+++ b/docs/html/guide/topics/ui/declaring-layout.jd
@@ -406,13 +406,13 @@ into a view that can be added into the {@link android.widget.AdapterView} layout
<div class="layout first">
<h4><a href="layout/listview.html">List View</a></h4>
- <a href="layout/list.html"><img src="{@docRoot}images/ui/listview-small.png" alt="" /></a>
+ <a href="layout/listview.html"><img src="{@docRoot}images/ui/listview-small.png" alt="" /></a>
<p>Displays a scrolling single column list.</p>
</div>
<div class="layout">
<h4><a href="layout/gridview.html">Grid View</a></h4>
- <a href="layout/grid.html"><img src="{@docRoot}images/ui/gridview-small.png" alt="" /></a>
+ <a href="layout/gridview.html"><img src="{@docRoot}images/ui/gridview-small.png" alt="" /></a>
<p>Displays a scrolling grid of columns and rows.</p>
</div>
diff --git a/docs/html/guide/topics/ui/layout/gridview.jd b/docs/html/guide/topics/ui/layout/gridview.jd
index 284a25a5271b..11c54740d631 100644
--- a/docs/html/guide/topics/ui/layout/gridview.jd
+++ b/docs/html/guide/topics/ui/layout/gridview.jd
@@ -1,4 +1,4 @@
-page.title=Grid
+page.title=Grid View
parent.title=Layouts
parent.link=layout-objects.html
@jd:body
diff --git a/docs/html/guide/topics/ui/settings.jd b/docs/html/guide/topics/ui/settings.jd
new file mode 100644
index 000000000000..fd3b684e2c8f
--- /dev/null
+++ b/docs/html/guide/topics/ui/settings.jd
@@ -0,0 +1,1171 @@
+page.title=Settings
+@jd:body
+
+
+<div id="qv-wrapper">
+<div id="qv">
+
+<h2>In this document</h2>
+<ol>
+ <li><a href="#Overview">Overview</a>
+ <ol>
+ <li><a href="#SettingTypes">Preferences</a></li>
+ </ol>
+ </li>
+ <li><a href="#DefiningPrefs">Defining Preferences in XML</a>
+ <ol>
+ <li><a href="#Groups">Creating setting groups</a></li>
+ <li><a href="#Intents">Using intents</a></li>
+ </ol>
+ </li>
+ <li><a href="#Activity">Creating a Preference Activity</a></li>
+ <li><a href="#Fragment">Using Preference Fragments</a></li>
+ <li><a href="#Defaults">Setting Default Values</a></li>
+ <li><a href="#PreferenceHeaders">Using Preference Headers</a>
+ <ol>
+ <li><a href="#CreateHeaders">Creating the headers file</a></li>
+ <li><a href="#DisplayHeaders">Displaying the headers</a></li>
+ <li><a href="#BackCompatHeaders">Supporting older versions with preference headers</a></li>
+ </ol>
+ </li>
+ <li><a href="#ReadingPrefs">Reading Preferences</a>
+ <ol>
+ <li><a href="#Listening">Listening for preference changes</a></li>
+ </ol>
+ </li>
+ <li><a href="#NetworkUsage">Managing Network Usage</a></li>
+ <li><a href="#Custom">Building a Custom Preference</a>
+ <ol>
+ <li><a href="#CustomSelected">Specifying the user interface</a></li>
+ <li><a href="#CustomSave">Saving the setting's value</a></li>
+ <li><a href="#CustomInitialize">Initializing the current value</a></li>
+ <li><a href="#CustomDefault">Providing a default value</a></li>
+ <li><a href="#CustomSaveState">Saving and restoring the Preference's state</a></li>
+ </ol>
+ </li>
+</ol>
+
+<h2>Key classes</h2>
+<ol>
+ <li>{@link android.preference.Preference}</li>
+ <li>{@link android.preference.PreferenceActivity}</li>
+ <li>{@link android.preference.PreferenceFragment}</li>
+</ol>
+
+
+<h2>See also</h2>
+<ol>
+ <li><a
+href="{@docRoot}design/patterns/settings.html">Settings design guide</a></li>
+</ol>
+</div>
+</div>
+
+
+
+
+<p>Applications often include settings that allow users to modify app features and behaviors. For
+example, some apps allow users to specify whether notifications are enabled or specify how often the
+application syncs data with the cloud.</p>
+
+<p>If you want to provide settings for your app, you should use
+Android's {@link android.preference.Preference} APIs to build an interface that's consistent with
+the user experience in other Android apps (including the system settings). This document describes
+how to build your app settings using {@link android.preference.Preference} APIs.</p>
+
+<div class="note design">
+<p><strong>Settings Design</strong></p>
+ <p>For information about how to design your settings, read the <a
+href="{@docRoot}design/patterns/settings.html">Settings</a> design guide.</p>
+</div>
+
+
+<img src="{@docRoot}images/ui/settings/settings.png" alt="" width="435" />
+<p class="img-caption"><strong>Figure 1.</strong> Screenshots from the Android Messaging app's
+settings. Selecting an item defined by a {@link android.preference.Preference}
+opens an interface to change the setting.</p>
+
+
+
+
+<h2 id="Overview">Overview</h2>
+
+<p>Instead of using {@link android.view.View} objects to build the user interface, settings are
+built using various subclasses of the {@link android.preference.Preference} class that you
+declare in an XML file.</p>
+
+<p>A {@link android.preference.Preference} object is the building block for a single
+setting. Each {@link android.preference.Preference} appears as an item in a list and provides the
+appropriate UI for users to modify the setting. For example, a {@link
+android.preference.CheckBoxPreference} creates a list item that shows a checkbox, and a {@link
+android.preference.ListPreference} creates an item that opens a dialog with a list of choices.</p>
+
+<p>Each {@link android.preference.Preference} you add has a corresponding key-value pair that
+the system uses to save the setting in a default {@link android.content.SharedPreferences}
+file for your app's settings. When the user changes a setting, the system updates the corresponding
+value in the {@link android.content.SharedPreferences} file for you. The only time you should
+directly interact with the associated {@link android.content.SharedPreferences} file is when you
+need to read the value in order to determine your app's behavior based on the user's setting.</p>
+
+<p>The value saved in {@link android.content.SharedPreferences} for each setting can be one of the
+following data types:</p>
+
+<ul>
+ <li>Boolean</li>
+ <li>Float</li>
+ <li>Int</li>
+ <li>Long</li>
+ <li>String</li>
+ <li>String {@link java.util.Set}</li>
+</ul>
+
+<p>Because your app's settings UI is built using {@link android.preference.Preference} objects
+instead of
+{@link android.view.View} objects, you need to use a specialized {@link android.app.Activity} or
+{@link android.app.Fragment} subclass to display the list settings:</p>
+
+<ul>
+ <li>If your app supports versions of Android older than 3.0 (API level 10 and lower), you must
+build the activity as an extension of the {@link android.preference.PreferenceActivity} class.</li>
+ <li>On Android 3.0 and later, you should instead use a traditional {@link android.app.Activity}
+that hosts a {@link android.preference.PreferenceFragment} that displays your app settings.
+However, you can also use {@link android.preference.PreferenceActivity} to create a two-pane layout
+for large screens when you have multiple groups of settings.</li>
+</ul>
+
+<p>How to set up your {@link android.preference.PreferenceActivity} and instances of {@link
+android.preference.PreferenceFragment} is discussed in the sections about <a
+href="#Activity">Creating a Preference Activity</a> and <a href="#Fragment">Using
+Preference Fragments</a>.</p>
+
+
+<h3 id="SettingTypes">Preferences</h3>
+
+<p>Every setting for your app is represented by a specific subclass of the {@link
+android.preference.Preference} class. Each subclass includes a set of core properties that allow you
+to specify things such as a title for the setting and the default value. Each subclass also provides
+its own specialized properties and user interface. For instance, figure 1 shows a screenshot from
+the Messaging app's settings. Each list item in the settings screen is backed by a different {@link
+android.preference.Preference} object.</p>
+
+<p>A few of the most common preferences are:</p>
+
+<dl>
+ <dt>{@link android.preference.CheckBoxPreference}</dt>
+ <dd>Shows an item with a checkbox for a setting that is either enabled or disabled. The saved
+value is a boolean (<code>true</code> if it's checked).</dd>
+
+ <dt>{@link android.preference.ListPreference}</dt>
+ <dd>Opens a dialog with a list of radio buttons. The saved value
+can be any one of the supported value types (listed above).</dd>
+
+ <dt>{@link android.preference.EditTextPreference}</dt>
+ <dd>Opens a dialog with an {@link android.widget.EditText} widget. The saved value is a {@link
+java.lang.String}.</dd>
+</dl>
+
+<p>See the {@link android.preference.Preference} class for a list of all other subclasses and their
+corresponding properties.</p>
+
+<p>Of course, the built-in classes don't accommodate every need and your application might require
+something more specialized. For example, the platform currently does not provide a {@link
+android.preference.Preference} class for picking a number or a date. So you might need to define
+your own {@link android.preference.Preference} subclass. For help doing so, see the section about <a
+href="#Custom">Building a Custom Preference</a>.</p>
+
+
+
+<h2 id="DefiningPrefs">Defining Preferences in XML</h2>
+
+<p>Although you can instantiate new {@link android.preference.Preference} objects at runtime, you
+should define your list of settings in XML with a hierarchy of {@link android.preference.Preference}
+objects. Using an XML file to define your collection of settings is preferred because the file
+provides an easy-to-read structure that's simple to update. Also, your app's settings are
+generally pre-determined, although you can still modify the collection at runtime.</p>
+
+<p>Each {@link android.preference.Preference} subclass can be declared with an XML element that
+matches the class name, such as {@code &lt;CheckBoxPreference>}.</p>
+
+<p>You must save the XML file in the {@code res/xml/} directory. Although you can name the file
+anything you want, it's traditionally named {@code preferences.xml}. You usually need only one file,
+because branches in the hierarchy (that open their own list of settings) are declared using nested
+instances of {@link android.preference.PreferenceScreen}.</p>
+
+<p class="note"><strong>Note:</strong> If you want to create a multi-pane layout for your
+settings, then you need separate XML files for each fragment.</p>
+
+<p>The root node for the XML file must be a {@link android.preference.PreferenceScreen
+&lt;PreferenceScreen&gt;} element. Within this element is where you add each {@link
+android.preference.Preference}. Each child you add within the
+{@link android.preference.PreferenceScreen &lt;PreferenceScreen&gt;} element appears as a single
+item in the list of settings.</p>
+
+<p>For example:</p>
+
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?>
+&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ &lt;CheckBoxPreference
+ android:key="pref_sync"
+ android:title="@string/pref_sync"
+ android:summary="@string/pref_sync_summ"
+ android:defaultValue="true" />
+ &lt;ListPreference
+ android:dependency="pref_sync"
+ android:key="pref_syncConnectionType"
+ android:title="@string/pref_syncConnectionType"
+ android:dialogTitle="@string/pref_syncConnectionType"
+ android:entries="@array/pref_syncConnectionTypes_entries"
+ android:entryValues="@array/pref_syncConnectionTypes_values"
+ android:defaultValue="@string/pref_syncConnectionTypes_default" >
+&lt;/PreferenceScreen>
+</pre>
+
+<p>In this example, there's a {@link android.preference.CheckBoxPreference} and a {@link
+android.preference.ListPreference}. Both items include the following three attributes:</p>
+
+<dl>
+ <dt>{@code android:key}</dt>
+ <dd>This attribute is required for preferences that persist a data value. It specifies the unique
+key (a string) the system uses when saving this setting's value in the {@link
+android.content.SharedPreferences}.
+ <p>The only instances in which this attribute is <em>not required</em> is when the preference is a
+{@link android.preference.PreferenceCategory} or {@link android.preference.PreferenceScreen}, or the
+preference specifies an {@link android.content.Intent} to invoke (with an <a
+href="#Intents">{@code &lt;intent&gt;}</a> element) or a {@link android.app.Fragment} to display (with an <a
+href="{@docRoot}reference/android/preference/Preference.html#attr_android:fragment">{@code
+android:fragment}</a> attribute).</p>
+ </dd>
+ <dt>{@code android:title}</dt>
+ <dd>This provides a user-visible name for the setting.</dd>
+ <dt>{@code android:defaultValue}</dt>
+ <dd>This specifies the initial value that the system should set in the {@link
+android.content.SharedPreferences} file. You should supply a default value for all
+settings.</dd>
+</dl>
+
+<p>For information about all other supported attributes, see the {@link
+android.preference.Preference} (and respective subclass) documentation.</p>
+
+
+<div class="figure" style="width:300px">
+ <img src="{@docRoot}images/ui/settings/settings-titles.png" alt="" />
+ <p class="img-caption"><strong>Figure 2.</strong> Setting categories
+ with titles. <br/><b>1.</b> The category is specified by the {@link
+android.preference.PreferenceCategory &lt;PreferenceCategory>} element. <br/><b>2.</b> The title is
+specified with the {@code android:title} attribute.</p>
+</div>
+
+
+<p>When your list of settings exceeds about 10 items, you might want to add titles to
+define groups of settings or display those groups in a
+separate screen. These options are described in the following sections.</p>
+
+
+<h3 id="Groups">Creating setting groups</h3>
+
+<p>If you present a list of 10 or more settings, users
+may have difficulty scanning, comprehending, and processing them. You can remedy this by
+dividing some or all of the settings into groups, effectively turning one long list into multiple
+shorter lists. A group of related settings can be presented in one of two ways:</p>
+
+<ul>
+ <li><a href="#Titles">Using titles</a></li>
+ <li><a href="#Subscreens">Using subscreens</a></li>
+</ul>
+
+<p>You can use one or both of these grouping techniques to organize your app's settings. When
+deciding which to use and how to divide your settings, you should follow the guidelines in Android
+Design's <a href="{@docRoot}design/patterns/settings.html">Settings</a> guide.</p>
+
+
+<h4 id="Titles">Using titles</h4>
+
+<p>If you want to provide dividers with headings between groups of settings (as shown in figure 2),
+place each group of {@link android.preference.Preference} objects inside a {@link
+android.preference.PreferenceCategory}.</p>
+
+<p>For example:</p>
+
+<pre>
+&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ &lt;PreferenceCategory
+ android:title="&#64;string/pref_sms_storage_title"
+ android:key="pref_key_storage_settings">
+ &lt;CheckBoxPreference
+ android:key="pref_key_auto_delete"
+ android:summary="&#64;string/pref_summary_auto_delete"
+ android:title="&#64;string/pref_title_auto_delete"
+ android:defaultValue="false"... />
+ &lt;Preference
+ android:key="pref_key_sms_delete_limit"
+ android:dependency="pref_key_auto_delete"
+ android:summary="&#64;string/pref_summary_delete_limit"
+ android:title="&#64;string/pref_title_sms_delete"... />
+ &lt;Preference
+ android:key="pref_key_mms_delete_limit"
+ android:dependency="pref_key_auto_delete"
+ android:summary="&#64;string/pref_summary_delete_limit"
+ android:title="&#64;string/pref_title_mms_delete" ... />
+ &lt;/PreferenceCategory>
+ ...
+&lt;/PreferenceScreen>
+</pre>
+
+
+<h4 id="Subscreens">Using subscreens</h4>
+
+<p>If you want to place groups of settings into a subscreen (as shown in figure 3), place the group
+of {@link android.preference.Preference} objects inside a {@link
+android.preference.PreferenceScreen}.</p>
+
+<img src="{@docRoot}images/ui/settings/settings-subscreen.png" alt="" />
+<p class="img-caption"><strong>Figure 3.</strong> Setting subscreens. The {@code
+&lt;PreferenceScreen>} element
+creates an item that, when selected, opens a separate list to display the nested settings.</p>
+
+<p>For example:</p>
+
+<pre>
+&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ &lt;!-- opens a subscreen of settings -->
+ &lt;PreferenceScreen
+ android:key="button_voicemail_category_key"
+ android:title="&#64;string/voicemail"
+ android:persistent="false">
+ &lt;ListPreference
+ android:key="button_voicemail_provider_key"
+ android:title="&#64;string/voicemail_provider" ... />
+ &lt;!-- opens another nested subscreen -->
+ &lt;PreferenceScreen
+ android:key="button_voicemail_setting_key"
+ android:title="&#64;string/voicemail_settings"
+ android:persistent="false">
+ ...
+ &lt;/PreferenceScreen>
+ &lt;RingtonePreference
+ android:key="button_voicemail_ringtone_key"
+ android:title="&#64;string/voicemail_ringtone_title"
+ android:ringtoneType="notification" ... />
+ ...
+ &lt;/PreferenceScreen>
+ ...
+&lt;/PreferenceScreen>
+</pre>
+
+
+<h3 id="Intents">Using intents</h3>
+
+<p>In some cases, you might want a preference item to open a different activity instead of a
+settings screen, such as a web browser to view a web page. To invoke an {@link
+android.content.Intent} when the user selects a preference item, add an {@code &lt;intent&gt;}
+element as a child of the corresponding {@code &lt;Preference&gt;} element.</p>
+
+<p>For example, here's how you can use a preference item to open a web page:</p>
+
+<pre>
+&lt;Preference android:title="@string/prefs_web_page" >
+ &lt;intent android:action="android.intent.action.VIEW"
+ android:data="http://www.example.com" />
+&lt;/Preference>
+</pre>
+
+<p>You can create both implicit and explicit intents using the following attributes:</p>
+
+<dl>
+ <dt>{@code android:action}</dt>
+ <dd>The action to assign, as per the {@link android.content.Intent#setAction setAction()}
+method.</dd>
+ <dt>{@code android:data}</dt>
+ <dd>The data to assign, as per the {@link android.content.Intent#setData setData()} method.</dd>
+ <dt>{@code android:mimeType}</dt>
+ <dd>The MIME type to assign, as per the {@link android.content.Intent#setType setType()}
+method.</dd>
+ <dt>{@code android:targetClass}</dt>
+ <dd>The class part of the component name, as per the {@link android.content.Intent#setComponent
+setComponent()} method.</dd>
+ <dt>{@code android:targetPackage}</dt>
+ <dd>The package part of the component name, as per the {@link
+android.content.Intent#setComponent setComponent()} method.</dd>
+</dl>
+
+
+
+<h2 id="Activity">Creating a Preference Activity</h2>
+
+<p>To display your settings in an activity, extend the {@link
+android.preference.PreferenceActivity} class. This is an extension of the traditional {@link
+android.app.Activity} class that displays a list of settings based on a hierarchy of {@link
+android.preference.Preference} objects. The {@link android.preference.PreferenceActivity}
+automatically persists the settings associated with each {@link
+android.preference.Preference} when the user makes a change.</p>
+
+<p class="note"><strong>Note:</strong> If you're developing your application for Android 3.0 and
+higher, you should instead use {@link android.preference.PreferenceFragment}. Go to the next
+section about <a href="#Fragment">Using Preference Fragments</a>.</p>
+
+<p>The most important thing to remember is that you do not load a layout of views during the {@link
+android.preference.PreferenceActivity#onCreate onCreate()} callback. Instead, you call {@link
+android.preference.PreferenceActivity#addPreferencesFromResource addPreferencesFromResource()} to
+add the preferences you've declared in an XML file to the activity. For example, here's the bare
+minimum code required for a functional {@link android.preference.PreferenceActivity}:</p>
+
+<pre>
+public class SettingsActivity extends PreferenceActivity {
+ &#64;Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.preferences);
+ }
+}
+</pre>
+
+<p>This is actually enough code for some apps, because as soon as the user modifies a preference,
+the system saves the changes to a default {@link android.content.SharedPreferences} file that your
+other application components can read when you need to check the user's settings. Many apps,
+however, require a little more code in order to listen for changes that occur to the preferences.
+For information about listening to changes in the {@link android.content.SharedPreferences} file,
+see the section about <a href="#ReadingPrefs">Reading Preferences</a>.</p>
+
+
+
+
+<h2 id="Fragment">Using Preference Fragments</h2>
+
+<p>If you're developing for Android 3.0 (API level 11) and higher, you should use a {@link
+android.preference.PreferenceFragment} to display your list of {@link android.preference.Preference}
+objects. You can add a {@link android.preference.PreferenceFragment} to any activity&mdash;you don't
+need to use {@link android.preference.PreferenceActivity}.</p>
+
+<p><a href="{@docRoot}guide/components/fragments.html">Fragments</a> provide a more
+flexible architecture for your application, compared to using activities alone, no matter what kind
+of activity you're building. As such, we suggest you use {@link
+android.preference.PreferenceFragment} to control the display of your settings instead of {@link
+android.preference.PreferenceActivity} when possible.</p>
+
+<p>Your implementation of {@link android.preference.PreferenceFragment} can be as simple as
+defining the {@link android.preference.PreferenceFragment#onCreate onCreate()} method to load a
+preferences file with {@link android.preference.PreferenceFragment#addPreferencesFromResource
+addPreferencesFromResource()}. For example:</p>
+
+<pre>
+public static class SettingsFragment extends PreferenceFragment {
+ &#64;Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.preferences);
+ }
+ ...
+}
+</pre>
+
+<p>You can then add this fragment to an {@link android.app.Activity} just as you would for any other
+{@link android.app.Fragment}. For example:</p>
+
+<pre>
+public class SettingsActivity extends Activity {
+ &#64;Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Display the fragment as the main content.
+ getFragmentManager().beginTransaction()
+ .replace(android.R.id.content, new SettingsFragment())
+ .commit();
+ }
+}
+</pre>
+
+<p class="note"><strong>Note:</strong> A {@link android.preference.PreferenceFragment} doesn't have
+a its own {@link android.content.Context} object. If you need a {@link android.content.Context}
+object, you can call {@link android.app.Fragment#getActivity()}. However, be careful to call
+{@link android.app.Fragment#getActivity()} only when the fragment is attached to an activity. When
+the fragment is not yet attached, or was detached during the end of its lifecycle, {@link
+android.app.Fragment#getActivity()} will return null.</p>
+
+
+<h2 id="Defaults">Setting Default Values</h2>
+
+<p>The preferences you create probably define some important behaviors for your application, so it's
+necessary that you initialize the associated {@link android.content.SharedPreferences} file with
+default values for each {@link android.preference.Preference} when the user first opens your
+application.</p>
+
+<p>The first thing you must do is specify a default value for each {@link
+android.preference.Preference}
+object in your XML file using the {@code android:defaultValue} attribute. The value can be any data
+type that is appropriate for the corresponding {@link android.preference.Preference} object. For
+example:</p>
+
+<pre>
+&lt;!-- default value is a boolean -->
+&lt;CheckBoxPreference
+ android:defaultValue="true"
+ ... />
+
+&lt;!-- default value is a string -->
+&lt;ListPreference
+ android:defaultValue="@string/pref_syncConnectionTypes_default"
+ ... />
+</pre>
+
+<p>Then, from the {@link android.app.Activity#onCreate onCreate()} method in your application's main
+activity&mdash;and in any other activity through which the user may enter your application for the
+first time&mdash;call {@link android.preference.PreferenceManager#setDefaultValues
+setDefaultValues()}:</p>
+
+<pre>
+PreferenceManager.setDefaultValues(this, R.xml.advanced_preferences, false);
+</pre>
+
+<p>Calling this during {@link android.app.Activity#onCreate onCreate()} ensures that your
+application is properly initialized with default settings, which your application might need to
+read in order to determine some behaviors (such as whether to download data while on a
+cellular network).</p>
+
+<p>This method takes three arguments:</p>
+<ul>
+ <li>Your application {@link android.content.Context}.</li>
+ <li>The resource ID for the preference XML file for which you want to set the default values.</li>
+ <li>A boolean indicating whether the default values should be set more than once.
+<p>When <code>false</code>, the system sets the default values only if this method has never been
+called in the past (or the {@link android.preference.PreferenceManager#KEY_HAS_SET_DEFAULT_VALUES}
+in the default value shared preferences file is false).</p></li>
+</ul>
+
+<p>As long as you set the third argument to <code>false</code>, you can safely call this method
+every time your activity starts without overriding the user's saved preferences by resetting them to
+the defaults. However, if you set it to <code>true</code>, you will override any previous
+values with the defaults.</p>
+
+
+
+<h2 id="PreferenceHeaders">Using Preference Headers</h2>
+
+<p>In rare cases, you might want to design your settings such that the first screen
+displays only a list of <a href="#Subscreens">subscreens</a> (such as in the system Settings app,
+as shown in figures 4 and 5). When you're developing such a design for Android 3.0 and higher, you
+should use a new "headers" feature in Android 3.0, instead of building subscreens with nested
+{@link android.preference.PreferenceScreen} elements.</p>
+
+<p>To build your settings with headers, you need to:</p>
+<ol>
+ <li>Separate each group of settings into separate instances of {@link
+android.preference.PreferenceFragment}. That is, each group of settings needs a separate XML
+file.</li>
+ <li>Create an XML headers file that lists each settings group and declares which fragment
+contains the corresponding list of settings.</li>
+ <li>Extend the {@link android.preference.PreferenceActivity} class to host your settings.</li>
+ <li>Implement the {@link
+android.preference.PreferenceActivity#onBuildHeaders onBuildHeaders()} callback to specify the
+headers file.</li>
+</ol>
+
+<p>A great benefit to using this design is that {@link android.preference.PreferenceActivity}
+automatically presents the two-pane layout shown in figure 4 when running on large screens.</p>
+
+<p>Even if your application supports versions of Android older than 3.0, you can build your
+application to use {@link android.preference.PreferenceFragment} for a two-pane presentation on
+newer devices while still supporting a traditional multi-screen hierarchy on older
+devices (see the section about <a href="#BackCompatHeaders">Supporting older versions with
+preference headers</a>).</p>
+
+<img src="{@docRoot}images/ui/settings/settings-headers-tablet.png" alt="" />
+<p class="img-caption"><strong>Figure 4.</strong> Two-pane layout with headers. <br/><b>1.</b> The
+headers are defined with an XML headers file. <br/><b>2.</b> Each group of settings is defined by a
+{@link android.preference.PreferenceFragment} that's specified by a {@code &lt;header>} element in
+the headers file.</p>
+
+<img src="{@docRoot}images/ui/settings/settings-headers-handset.png" alt="" />
+<p class="img-caption"><strong>Figure 5.</strong> A handset device with setting headers. When an
+item is selected, the associated {@link android.preference.PreferenceFragment} replaces the
+headers.</p>
+
+
+<h3 id="CreateHeaders" style="clear:left">Creating the headers file</h3>
+
+<p>Each group of settings in your list of headers is specified by a single {@code &lt;header>}
+element inside a root {@code &lt;preference-headers>} element. For example:</p>
+
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?>
+&lt;preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
+ &lt;header
+ android:fragment="com.example.prefs.SettingsActivity$SettingsFragmentOne"
+ android:title="@string/prefs_category_one"
+ android:summary="@string/prefs_summ_category_one" />
+ &lt;header
+ android:fragment="com.example.prefs.SettingsActivity$SettingsFragmentTwo"
+ android:title="@string/prefs_category_two"
+ android:summary="@string/prefs_summ_category_two" >
+ &lt;!-- key/value pairs can be included as arguments for the fragment. -->
+ &lt;extra android:name="someKey" android:value="someHeaderValue" />
+ &lt;/header>
+&lt;/preference-headers>
+</pre>
+
+<p>With the {@code android:fragment} attribute, each header declares an instance of {@link
+android.preference.PreferenceFragment} that should open when the user selects the header.</p>
+
+<p>The {@code &lt;extras>} element allows you to pass key-value pairs to the fragment in a {@link
+android.os.Bundle}. The fragment can retrieve the arguments by calling {@link
+android.app.Fragment#getArguments()}. You might pass arguments to the fragment for a variety of
+reasons, but one good reason is to reuse the same subclass of {@link
+android.preference.PreferenceFragment} for each group and use the argument to specify which
+preferences XML file the fragment should load.</p>
+
+<p>For example, here's a fragment that can be reused for multiple settings groups, when each
+header defines an {@code &lt;extra>} argument with the {@code "settings"} key:</p>
+
+<pre>
+public static class SettingsFragment extends PreferenceFragment {
+ &#64;Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ String settings = getArguments().getString("settings");
+ if ("notifications".equals(settings)) {
+ addPreferencesFromResource(R.xml.settings_wifi);
+ } else if ("sync".equals(settings)) {
+ addPreferencesFromResource(R.xml.settings_sync);
+ }
+ }
+}
+</pre>
+
+
+
+<h3 id="DisplayHeaders">Displaying the headers</h3>
+
+<p>To display the preference headers, you must implement the {@link
+android.preference.PreferenceActivity#onBuildHeaders onBuildHeaders()} callback method and call
+{@link android.preference.PreferenceActivity#loadHeadersFromResource
+loadHeadersFromResource()}. For example:</p>
+
+<pre>
+public class SettingsActivity extends PreferenceActivity {
+ &#64;Override
+ public void onBuildHeaders(List&lt;Header> target) {
+ loadHeadersFromResource(R.xml.preference_headers, target);
+ }
+}
+</pre>
+
+<p>When the user selects an item from the list of headers, the system opens the associated {@link
+android.preference.PreferenceFragment}.</p>
+
+<p class="note"><strong>Note:</strong> When using preference headers, your subclass of {@link
+android.preference.PreferenceActivity} doesn't need to implement the {@link
+android.preference.PreferenceActivity#onCreate onCreate()} method, because the only required
+task for the activity is to load the headers.</p>
+
+
+<h3 id="BackCompatHeaders">Supporting older versions with preference headers</h3>
+
+<p>If your application supports versions of Android older than 3.0, you can still use headers to
+provide a two-pane layout when running on Android 3.0 and higher. All you need to do is create an
+additional preferences XML file that uses basic {@link android.preference.Preference
+&lt;Preference>} elements that behave like the header items (to be used by the older Android
+versions).</p>
+
+<p>Instead of opening a new {@link android.preference.PreferenceScreen}, however, each of the {@link
+android.preference.Preference &lt;Preference>} elements sends an {@link android.content.Intent} to
+the {@link android.preference.PreferenceActivity} that specifies which preference XML file to
+load.</p>
+
+<p>For example, here's an XML file for preference headers that is used on Android 3.0
+and higher ({@code res/xml/preference_headers.xml}):</p>
+
+<pre>
+&lt;preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
+ &lt;header
+ android:fragment="com.example.prefs.SettingsFragmentOne"
+ android:title="@string/prefs_category_one"
+ android:summary="@string/prefs_summ_category_one" />
+ &lt;header
+ android:fragment="com.example.prefs.SettingsFragmentTwo"
+ android:title="@string/prefs_category_two"
+ android:summary="@string/prefs_summ_category_two" />
+&lt;/preference-headers>
+</pre>
+
+<p>And here is a preference file that provides the same headers for versions older than
+Android 3.0 ({@code res/xml/preference_headers_legacy.xml}):</p>
+
+<pre>
+&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ &lt;Preference
+ android:title="@string/prefs_category_one"
+ android:summary="@string/prefs_summ_category_one" >
+ &lt;intent
+ android:targetPackage="com.example.prefs"
+ android:targetClass="com.example.prefs.SettingsActivity"
+ android:action="com.example.prefs.PREFS_ONE" />
+ &lt;/Preference>
+ &lt;Preference
+ android:title="@string/prefs_category_two"
+ android:summary="@string/prefs_summ_category_two" >
+ &lt;intent
+ android:targetPackage="com.example.prefs"
+ android:targetClass="com.example.prefs.SettingsActivity"
+ android:action="com.example.prefs.PREFS_TWO" />
+ &lt;/Preference>
+&lt;/PreferenceScreen>
+</pre>
+
+<p>Because support for {@code &lt;preference-headers>} was added in Android 3.0, the system calls
+{@link android.preference.PreferenceActivity#onBuildHeaders onBuildHeaders()} in your {@link
+android.preference.PreferenceActivity} only when running on Androd 3.0 or higher. In order to load
+the "legacy" headers file ({@code preference_headers_legacy.xml}), you must check the Android
+version and, if the version is older than Android 3.0 ({@link
+android.os.Build.VERSION_CODES#HONEYCOMB}), call {@link
+android.preference.PreferenceActivity#addPreferencesFromResource addPreferencesFromResource()} to
+load the legacy header file. For example:</p>
+
+<pre>
+&#64;Override
+public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ ...
+
+ if (Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.HONEYCOMB) {
+ // Load the legacy preferences headers
+ addPreferencesFromResource(R.xml.preference_headers_legacy);
+ }
+}
+
+// Called only on Honeycomb and later
+&#64;Override
+public void onBuildHeaders(List&lt;Header> target) {
+ loadHeadersFromResource(R.xml.preference_headers, target);
+}
+</pre>
+
+<p>The only thing left to do is handle the {@link android.content.Intent} that's passed into the
+activity to identify which preference file to load. So retrieve the intent's action and compare it
+to known action strings that you've used in the preference XML's {@code &lt;intent>} tags:</p>
+
+<pre>
+final static String ACTION_PREFS_ONE = "com.example.prefs.PREFS_ONE";
+...
+
+&#64;Override
+public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ String action = getIntent().getAction();
+ if (action != null &amp;&amp; action.equals(ACTION_PREFS_ONE)) {
+ addPreferencesFromResource(R.xml.preferences);
+ }
+ ...
+
+ else if (Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.HONEYCOMB) {
+ // Load the legacy preferences headers
+ addPreferencesFromResource(R.xml.preference_headers_legacy);
+ }
+}
+</pre>
+
+<p>Beware that consecutive calls to {@link
+android.preference.PreferenceActivity#addPreferencesFromResource addPreferencesFromResource()} will
+stack all the preferences in a single list, so be sure that it's only called once by chaining the
+conditions with else-if statements.</p>
+
+
+
+
+
+<h2 id="ReadingPrefs">Reading Preferences</h2>
+
+<p>By default, all your app's preferences are saved to a file that's accessible from anywhere
+within your application by calling the static method {@link
+android.preference.PreferenceManager#getDefaultSharedPreferences
+PreferenceManager.getDefaultSharedPreferences()}. This returns the {@link
+android.content.SharedPreferences} object containing all the key-value pairs that are associated
+with the {@link android.preference.Preference} objects used in your {@link
+android.preference.PreferenceActivity}.</p>
+
+<p>For example, here's how you can read one of the preference values from any other activity in your
+application:</p>
+
+<pre>
+SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
+String syncConnPref = sharedPref.getString(SettingsActivity.KEY_PREF_SYNC_CONN, "");
+</pre>
+
+
+
+<h3 id="Listening">Listening for preference changes</h3>
+
+<p>There are several reasons you might want to be notified as soon as the use changes one of the
+preferences. In order to receive a callback when a change happens to any one of the preferences,
+implement the {@link android.content.SharedPreferences.OnSharedPreferenceChangeListener
+SharedPreference.OnSharedPreferenceChangeListener} interface and register the listener for the
+{@link android.content.SharedPreferences} object by calling {@link
+android.content.SharedPreferences#registerOnSharedPreferenceChangeListener
+registerOnSharedPreferenceChangeListener()}.</p>
+
+<p>The interface has only one callback method, {@link
+android.content.SharedPreferences.OnSharedPreferenceChangeListener#onSharedPreferenceChanged
+onSharedPreferenceChanged()}, and you might find it easiest to implement the interface as a part of
+your activity. For example:</p>
+
+<pre>
+public class SettingsActivity extends PreferenceActivity
+ implements OnSharedPreferenceChangeListener {
+ public static final String KEY_PREF_SYNC_CONN = "pref_syncConnectionType";
+ ...
+
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
+ if (key.equals(KEY_PREF_SYNC_CONN)) {
+ Preference connectionPref = findPreference(key);
+ // Set summary to be the user-description for the selected value
+ connectionPref.setSummary(sharedPreferences.getString(key, ""));
+ }
+ }
+}
+</pre>
+
+<p>In this example, the method checks whether the changed setting is for a known preference key. It
+calls {@link android.preference.PreferenceActivity#findPreference findPreference()} to get the
+{@link android.preference.Preference} object that was changed so it can modify the item's
+summary to be a description of the user's selection. That is, when the setting is a {@link
+android.preference.ListPreference} or other multiple choice setting, you should call {@link
+android.preference.Preference#setSummary setSummary()} when the setting changes to display the
+current status (such as the Sleep setting shown in figure 5).</p>
+
+<p class="note"><strong>Note:</strong> As described in the Android Design document about <a
+href="{@docRoot}design/patterns/settings.html">Settings</a>, we recommend that you update the
+summary for a {@link android.preference.ListPreference} each time the user changes the preference in
+order to describe the current setting.</p>
+
+<p>For proper lifecycle management in the activity, we recommend that you register and unregister
+your {@link android.content.SharedPreferences.OnSharedPreferenceChangeListener} during the {@link
+android.app.Activity#onResume} and {@link android.app.Activity#onPause} callbacks, respectively:</p>
+
+<pre>
+&#64;Override
+protected void onResume() {
+ super.onResume();
+ getPreferenceScreen().getSharedPreferences()
+ .registerOnSharedPreferenceChangeListener(this);
+}
+
+&#64;Override
+protected void onPause() {
+ super.onPause();
+ getPreferenceScreen().getSharedPreferences()
+ .unregisterOnSharedPreferenceChangeListener(this);
+}
+</pre>
+
+
+
+<h2 id="NetworkUsage">Managing Network Usage</h2>
+
+
+<p>Beginning with Android 4.0, the system's Settings application allows users to see how much
+network data their applications are using while in the foreground and background. Users can then
+disable the use of background data for individual apps. In order to avoid users disabling your app's
+access to data from the background, you should use the data connection efficiently and allow
+users to refine your app's data usage through your application settings.<p>
+
+<p>For example, you might allow the user to control how often your app syncs data, whether your app
+performs uploads/downloads only when on Wi-Fi, whether your app uses data while roaming, etc. With
+these controls available to them, users are much less likely to disable your app's access to data
+when they approach the limits they set in the system Settings, because they can instead precisely
+control how much data your app uses.</p>
+
+<p>Once you've added the necessary preferences in your {@link android.preference.PreferenceActivity}
+to control your app's data habits, you should add an intent filter for {@link
+android.content.Intent#ACTION_MANAGE_NETWORK_USAGE} in your manifest file. For example:</p>
+
+<pre>
+&lt;activity android:name="SettingsActivity" ... >
+ &lt;intent-filter>
+ &lt;action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
+ &lt;category android:name="android.intent.category.DEFAULT" />
+ &lt;/intent-filter>
+&lt;/activity>
+</pre>
+
+<p>This intent filter indicates to the system that this is the activity that controls your
+application's data usage. Thus, when the user inspects how much data your app is using from the
+system's Settings app, a <em>View application settings</em> button is available that launches your
+{@link android.preference.PreferenceActivity} so the user can refine how much data your app
+uses.</p>
+
+
+
+
+
+
+
+<h2 id="Custom">Building a Custom Preference</h2>
+
+<p>The Android framework includes a variety of {@link android.preference.Preference} subclasses that
+allow you to build a UI for several different types of settings.
+However, you might discover a setting you need for which there’s no built-in solution, such as a
+number picker or date picker. In such a case, you’ll need to create a custom preference by extending
+the {@link android.preference.Preference} class or one of the other subclasses.</p>
+
+<p>When you extend the {@link android.preference.Preference} class, there are a few important
+things you need to do:</p>
+
+<ul>
+ <li>Specify the user interface that appears when the user selects the settings.</li>
+ <li>Save the setting's value when appropriate.</li>
+ <li>Initialize the {@link android.preference.Preference} with the current (or default) value
+when it comes into view.</li>
+ <li>Provide the default value when requested by the system.</li>
+ <li>If the {@link android.preference.Preference} provides its own UI (such as a dialog), save
+and restore the state to handle lifecycle changes (such as when the user rotates the screen).</li>
+</ul>
+
+<p>The following sections describe how to accomplish each of these tasks.</p>
+
+
+
+<h3 id="CustomSelected">Specifying the user interface</h3>
+
+ <p>If you directly extend the {@link android.preference.Preference} class, you need to implement
+{@link android.preference.Preference#onClick()} to define the action that occurs when the user
+selects the item. However, most custom settings extend {@link android.preference.DialogPreference} to
+show a dialog, which simplifies the procedure. When you extend {@link
+android.preference.DialogPreference}, you must call {@link
+android.preference.DialogPreference#setDialogLayoutResource setDialogLayoutResourcs()} during in the
+class constructor to specify the layout for the dialog.</p>
+
+ <p>For example, here's the constructor for a custom {@link
+android.preference.DialogPreference} that declares the layout and specifies the text for the
+default positive and negative dialog buttons:</p>
+
+<pre>
+public class NumberPickerPreference extends DialogPreference {
+ public NumberPickerPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ setDialogLayoutResource(R.layout.numberpicker_dialog);
+ setPositiveButtonText(android.R.string.ok);
+ setNegativeButtonText(android.R.string.cancel);
+
+ setDialogIcon(null);
+ }
+ ...
+}
+</pre>
+
+
+
+<h3 id="CustomSave">Saving the setting's value</h3>
+
+<p>You can save a value for the setting at any time by calling one of the {@link
+android.preference.Preference} class's {@code persist*()} methods, such as {@link
+android.preference.Preference#persistInt persistInt()} if the setting's value is an integer or
+{@link android.preference.Preference#persistBoolean persistBoolean()} to save a boolean.</p>
+
+<p class="note"><strong>Note:</strong> Each {@link android.preference.Preference} can save only one
+data type, so you must use the {@code persist*()} method appropriate for the data type used by your
+custom {@link android.preference.Preference}.</p>
+
+<p>When you choose to persist the setting can depend on which {@link
+android.preference.Preference} class you extend. If you extend {@link
+android.preference.DialogPreference}, then you should persist the value only when the dialog
+closes due to a positive result (the user selects the "OK" button).</p>
+
+<p>When a {@link android.preference.DialogPreference} closes, the system calls the {@link
+android.preference.DialogPreference#onDialogClosed onDialogClosed()} method. The method includes a
+boolean argument that specifies whether the user result is "positive"&mdash;if the value is
+<code>true</code>, then the user selected the positive button and you should save the new value. For
+example:</p>
+
+<pre>
+&#64;Override
+protected void onDialogClosed(boolean positiveResult) {
+ // When the user selects "OK", persist the new value
+ if (positiveResult) {
+ persistInt(mNewValue);
+ }
+}
+</pre>
+
+<p>In this example, <code>mNewValue</code> is a class member that holds the setting's current
+value. Calling {@link android.preference.Preference#persistInt persistInt()} saves the value to
+the {@link android.content.SharedPreferences} file (automatically using the key that's
+specified in the XML file for this {@link android.preference.Preference}).</p>
+
+
+<h3 id="CustomInitialize">Initializing the current value</h3>
+
+<p>When the system adds your {@link android.preference.Preference} to the screen, it
+calls {@link android.preference.Preference#onSetInitialValue onSetInitialValue()} to notify
+you whether the setting has a persisted value. If there is no persisted value, this call provides
+you the default value.</p>
+
+<p>The {@link android.preference.Preference#onSetInitialValue onSetInitialValue()} method passes
+a boolean, <code>restorePersistedValue</code>, to indicate whether a value has already been persisted
+for the setting. If it is <code>true</code>, then you should retrieve the persisted value by calling
+one of the {@link
+android.preference.Preference} class's {@code getPersisted*()} methods, such as {@link
+android.preference.Preference#getPersistedInt getPersistedInt()} for an integer value. You'll
+usually want to retrieve the persisted value so you can properly update the UI to reflect the
+previously saved value.</p>
+
+<p>If <code>restorePersistedValue</code> is <code>false</code>, then you
+should use the default value that is passed in the second argument.</p>
+
+<pre>
+&#64;Override
+protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) {
+ if (restorePersistedValue) {
+ // Restore existing state
+ mCurrentValue = this.getPersistedInt(DEFAULT_VALUE);
+ } else {
+ // Set default state from the XML attribute
+ mCurrentValue = (Integer) defaultValue;
+ persistInt(mCurrentValue);
+ }
+}
+</pre>
+
+<p>Each {@code getPersisted*()} method takes an argument that specifies the
+default value to use in case there is actually no persisted value or the key does not exist. In
+the example above, a local constant is used to specify the default value in case {@link
+android.preference.Preference#getPersistedInt getPersistedInt()} can't return a persisted value.</p>
+
+<p class="caution"><strong>Caution:</strong> You <strong>cannot</strong> use the
+<code>defaultValue</code> as the default value in the {@code getPersisted*()} method, because
+its value is always null when <code>restorePersistedValue</code> is <code>true</code>.</p>
+
+
+<h3 id="CustomDefault">Providing a default value</h3>
+
+<p>If the instance of your {@link android.preference.Preference} class specifies a default value
+(with the {@code android:defaultValue} attribute), then the
+system calls {@link android.preference.Preference#onGetDefaultValue
+onGetDefaultValue()} when it instantiates the object in order to retrieve the value. You must
+implement this method in order for the system to save the default value in the {@link
+android.content.SharedPreferences}. For example:</p>
+
+<pre>
+&#64;Override
+protected Object onGetDefaultValue(TypedArray a, int index) {
+ return a.getInteger(index, DEFAULT_VALUE);
+}
+</pre>
+
+<p>The method arguments provide everything you need: the array of attributes and the index
+position of the {@code android:defaultValue}, which you must retrieve. The reason you must
+implement this method to extract the default value from the attribute is because you must specify
+a local default value for the attribute in case the value is undefined.</p>
+
+
+
+<h3 id="CustomSaveState">Saving and restoring the Preference's state</h3>
+
+<p>Just like a {@link android.view.View} in a layout, your {@link android.preference.Preference}
+subclass is responsible for saving and restoring its state in case the activity or fragment is
+restarted (such as when the user rotates the screen). To properly save and
+restore the state of your {@link android.preference.Preference} class, you must implement the
+lifecycle callback methods {@link android.preference.Preference#onSaveInstanceState
+onSaveInstanceState()} and {@link
+android.preference.Preference#onRestoreInstanceState onRestoreInstanceState()}.</p>
+
+<p>The state of your {@link android.preference.Preference} is defined by an object that implements
+the {@link android.os.Parcelable} interface. The Android framework provides such an object for you
+as a starting point to define your state object: the {@link
+android.preference.Preference.BaseSavedState} class.</p>
+
+<p>To define how your {@link android.preference.Preference} class saves its state, you should
+extend the {@link android.preference.Preference.BaseSavedState} class. You need to override just
+ a few methods and define the {@link android.preference.Preference.BaseSavedState#CREATOR}
+object.</p>
+
+<p>For most apps, you can copy the following implementation and simply change the lines that
+handle the {@code value} if your {@link android.preference.Preference} subclass saves a data
+type other than an integer.</p>
+
+<pre>
+private static class SavedState extends BaseSavedState {
+ // Member that holds the setting's value
+ // Change this data type to match the type saved by your Preference
+ int value;
+
+ public SavedState(Parcelable superState) {
+ super(superState);
+ }
+
+ public SavedState(Parcel source) {
+ super(source);
+ // Get the current preference's value
+ value = source.readInt(); // Change this to read the appropriate data type
+ }
+
+ &#64;Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+ // Write the preference's value
+ dest.writeInt(value); // Change this to write the appropriate data type
+ }
+
+ // Standard creator object using an instance of this class
+ public static final Parcelable.Creator&lt;SavedState> CREATOR =
+ new Parcelable.Creator&lt;SavedState>() {
+
+ public SavedState createFromParcel(Parcel in) {
+ return new SavedState(in);
+ }
+
+ public SavedState[] newArray(int size) {
+ return new SavedState[size];
+ }
+ };
+}
+</pre>
+
+<p>With the above implementation of {@link android.preference.Preference.BaseSavedState} added
+to your app (usually as a subclass of your {@link android.preference.Preference} subclass), you
+then need to implement the {@link android.preference.Preference#onSaveInstanceState
+onSaveInstanceState()} and {@link
+android.preference.Preference#onRestoreInstanceState onRestoreInstanceState()} methods for your
+{@link android.preference.Preference} subclass.</p>
+
+<p>For example:</p>
+
+<pre>
+&#64;Override
+protected Parcelable onSaveInstanceState() {
+ final Parcelable superState = super.onSaveInstanceState();
+ // Check whether this Preference is persistent (continually saved)
+ if (isPersistent()) {
+ // No need to save instance state since it's persistent, use superclass state
+ return superState;
+ }
+
+ // Create instance of custom BaseSavedState
+ final SavedState myState = new SavedState(superState);
+ // Set the state's value with the class member that holds current setting value
+ myState.value = mNewValue;
+ return myState;
+}
+
+&#64;Override
+protected void onRestoreInstanceState(Parcelable state) {
+ // Check whether we saved the state in onSaveInstanceState
+ if (state == null || !state.getClass().equals(SavedState.class)) {
+ // Didn't save the state, so call superclass
+ super.onRestoreInstanceState(state);
+ return;
+ }
+
+ // Cast state to custom BaseSavedState and pass to superclass
+ SavedState myState = (SavedState) state;
+ super.onRestoreInstanceState(myState.getSuperState());
+
+ // Set this Preference's widget to reflect the restored state
+ mNumberPicker.setValue(myState.value);
+}
+</pre>
+
diff --git a/docs/html/images/ui/settings/settings-headers-handset.png b/docs/html/images/ui/settings/settings-headers-handset.png
new file mode 100644
index 000000000000..d04ad17bbc4b
--- /dev/null
+++ b/docs/html/images/ui/settings/settings-headers-handset.png
Binary files differ
diff --git a/docs/html/images/ui/settings/settings-headers-tablet.png b/docs/html/images/ui/settings/settings-headers-tablet.png
new file mode 100644
index 000000000000..d0da5f2f1889
--- /dev/null
+++ b/docs/html/images/ui/settings/settings-headers-tablet.png
Binary files differ
diff --git a/docs/html/images/ui/settings/settings-subscreen.png b/docs/html/images/ui/settings/settings-subscreen.png
new file mode 100644
index 000000000000..17de231afbb3
--- /dev/null
+++ b/docs/html/images/ui/settings/settings-subscreen.png
Binary files differ
diff --git a/docs/html/images/ui/settings/settings-titles.png b/docs/html/images/ui/settings/settings-titles.png
new file mode 100644
index 000000000000..df4e1b49369f
--- /dev/null
+++ b/docs/html/images/ui/settings/settings-titles.png
Binary files differ
diff --git a/docs/html/images/ui/settings/settings.png b/docs/html/images/ui/settings/settings.png
new file mode 100644
index 000000000000..db9976c19131
--- /dev/null
+++ b/docs/html/images/ui/settings/settings.png
Binary files differ
diff --git a/docs/html/shareables/README b/docs/html/shareables/README
new file mode 100644
index 000000000000..241618edb1fb
--- /dev/null
+++ b/docs/html/shareables/README
@@ -0,0 +1,8 @@
+DO NOT PUT ANY FILES IN THIS DIRECTORY
+
+All URLS pointing to this directory redirect to a corresponding location
+at http://commondatastorage.googleapis.com/androiddevelopers/shareables/
+
+This directory was originally created for downloadable items such as ZIP files,
+but we've moved them all to Google Cloud Storage to reduce the size
+of the Android Developers site. \ No newline at end of file
diff --git a/docs/html/shareables/app_widget_templates-v4.0.zip b/docs/html/shareables/app_widget_templates-v4.0.zip
deleted file mode 100644
index b16ef127c204..000000000000
--- a/docs/html/shareables/app_widget_templates-v4.0.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/icon_templates-v2.0.zip b/docs/html/shareables/icon_templates-v2.0.zip
deleted file mode 100644
index 1b94698ef4cb..000000000000
--- a/docs/html/shareables/icon_templates-v2.0.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/icon_templates-v2.3.zip b/docs/html/shareables/icon_templates-v2.3.zip
deleted file mode 100644
index 58d90aeb6622..000000000000
--- a/docs/html/shareables/icon_templates-v2.3.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/icon_templates-v4.0.zip b/docs/html/shareables/icon_templates-v4.0.zip
deleted file mode 100644
index 49e629fabde0..000000000000
--- a/docs/html/shareables/icon_templates-v4.0.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/sample_images.zip b/docs/html/shareables/sample_images.zip
deleted file mode 100644
index 007a68aca79e..000000000000
--- a/docs/html/shareables/sample_images.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/search_icons.zip b/docs/html/shareables/search_icons.zip
deleted file mode 100644
index bc984655592d..000000000000
--- a/docs/html/shareables/search_icons.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/ActivityLifecycle.zip b/docs/html/shareables/training/ActivityLifecycle.zip
deleted file mode 100644
index 1cbed448b2bb..000000000000
--- a/docs/html/shareables/training/ActivityLifecycle.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/BitmapFun.zip b/docs/html/shareables/training/BitmapFun.zip
deleted file mode 100644
index e7e71f9f85a0..000000000000
--- a/docs/html/shareables/training/BitmapFun.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/CustomView.zip b/docs/html/shareables/training/CustomView.zip
deleted file mode 100644
index d7ae8a2268c7..000000000000
--- a/docs/html/shareables/training/CustomView.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/DeviceManagement.zip b/docs/html/shareables/training/DeviceManagement.zip
deleted file mode 100644
index 9f7ec694af47..000000000000
--- a/docs/html/shareables/training/DeviceManagement.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/EffectiveNavigation.zip b/docs/html/shareables/training/EffectiveNavigation.zip
deleted file mode 100644
index f21af451f39e..000000000000
--- a/docs/html/shareables/training/EffectiveNavigation.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/FragmentBasics.zip b/docs/html/shareables/training/FragmentBasics.zip
deleted file mode 100644
index b5b19d03ba5a..000000000000
--- a/docs/html/shareables/training/FragmentBasics.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/LocationAware.zip b/docs/html/shareables/training/LocationAware.zip
deleted file mode 100644
index 8ed97cbff32a..000000000000
--- a/docs/html/shareables/training/LocationAware.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/MobileAds.zip b/docs/html/shareables/training/MobileAds.zip
deleted file mode 100644
index 468e4ee72511..000000000000
--- a/docs/html/shareables/training/MobileAds.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/NetworkUsage.zip b/docs/html/shareables/training/NetworkUsage.zip
deleted file mode 100644
index 8c7fbef9fb49..000000000000
--- a/docs/html/shareables/training/NetworkUsage.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/NewsReader.zip b/docs/html/shareables/training/NewsReader.zip
deleted file mode 100644
index 7dda41c7c273..000000000000
--- a/docs/html/shareables/training/NewsReader.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/OpenGLES.zip b/docs/html/shareables/training/OpenGLES.zip
deleted file mode 100644
index 862ae1f87984..000000000000
--- a/docs/html/shareables/training/OpenGLES.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/PhotoIntentActivity.zip b/docs/html/shareables/training/PhotoIntentActivity.zip
deleted file mode 100644
index 9fcc0e19a7c8..000000000000
--- a/docs/html/shareables/training/PhotoIntentActivity.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/shareables/training/TabCompat.zip b/docs/html/shareables/training/TabCompat.zip
deleted file mode 100644
index b70b44212581..000000000000
--- a/docs/html/shareables/training/TabCompat.zip
+++ /dev/null
Binary files differ
diff --git a/docs/html/tools/adk/adk.jd b/docs/html/tools/adk/adk.jd
index 2a0c7170f786..049b6e92804a 100644
--- a/docs/html/tools/adk/adk.jd
+++ b/docs/html/tools/adk/adk.jd
@@ -41,7 +41,7 @@ page.title=Accessory Development Kit 2011 Guide
<h2>Download</h2>
<ol>
- <li><a href="https://dl-ssl.google.com/android/adk/adk_release_0512.zip">ADK package</a></li>
+ <li><a href="https://dl-ssl.google.com/android/adk/adk_release_20120606.zip">ADK package</a></li>
</ol>
<h2>See also</h2>
diff --git a/docs/html/training/cloudsync/aesync.jd b/docs/html/training/cloudsync/aesync.jd
deleted file mode 100644
index a21b4293ebaa..000000000000
--- a/docs/html/training/cloudsync/aesync.jd
+++ /dev/null
@@ -1,432 +0,0 @@
-page.title=Syncing with App Engine
-parent.title=Syncing to the Cloud
-parent.link=index.html
-
-trainingnavtop=true
-next.title=Using the Backup API
-next.link=backupapi.html
-
-@jd:body
-
-<div id="tb-wrapper">
-<div id="tb">
-
-<!-- table of contents -->
-<h2>This lesson teaches you how to</h2>
-<ol>
- <li><a href="#prepare">Prepare Your Environment</a></li>
- <li><a href="#project">Create Your Project</a></li>
- <li><a href="#data">Create the Data Layer</a></li>
- <li><a href="#persistence">Create the Persistence Layer</a></li>
- <li><a href="#androidapp">Query and Update from the Android App</a></li>
- <li><a href="#serverc2dm">Configure the C2DM Server-Side</a></li>
- <li><a href="#clientc2dm">Configure the C2DM Client-Side</a></li>
-</ol>
-<h2>You should also read</h2>
- <ul>
- <li><a
- href="http://developers.google.com/appengine/">App Engine</a></li>
- <li><a href="http://code.google.com/android/c2dm/">Android Cloud to Device
- Messaging Framework</a></li>
- </ul>
-<h2>Try it out</h2>
-
-<p>This lesson uses the Cloud Tasks sample code, originally shown at the
-<a href="http://www.youtube.com/watch?v=M7SxNNC429U">Android + AppEngine: A Developer's Dream Combination</a>
-talk at Google I/O. You can use the sample application as a source of reusable code for your own
-application, or simply as a reference for how the Android and cloud pieces of the overall
-application fit together. You can also build the sample application and see how it runs
-on your own device or emulator.</p>
-<p>
- <a href="http://code.google.com/p/cloud-tasks-io/" class="button">Cloud Tasks
- App</a>
-</p>
-
-</div>
-</div>
-
-<p>Writing an app that syncs to the cloud can be a challenge. There are many little
-details to get right, like server-side auth, client-side auth, a shared data
-model, and an API. One way to make this much easier is to use the Google Plugin
-for Eclipse, which handles a lot of the plumbing for you when building Android
-and App Engine applications that talk to each other. This lesson walks you through building such a project.</p>
-
-<p>Following this lesson shows you how to:</p>
-<ul>
- <li>Build Android and Appengine apps that can communicate with each other</li>
- <li>Take advantage of Cloud to Device Messaging (C2DM) so your Android app doesn't have to poll for updates</li>
-</ul>
-
-<p>This lesson focuses on local development, and does not cover distribution
-(i.e, pushing your App Engine app live, or publishing your Android App to
-market), as those topics are covered extensively elsewhere.</p>
-
-<h2 id="prepare">Prepare Your Environment</h2>
-<p>If you want to follow along with the code example in this lesson, you must do
-the following to prepare your development environment:</p>
-<ul>
-<li>Install the <a href="http://code.google.com/eclipse/">Google Plugin for
- Eclipse.</a></li>
-<li>Install the <a
- href="http://code.google.com/webtoolkit/download.html">GWT SDK</a> and the <a
- href="http://code.google.com/appengine/">Java App Engine SDK</a>. The <a
- href="http://code.google.com/eclipse/docs/getting_started.html">Quick Start
- Guide</a> shows you how to install these components.</li>
-<li>Sign up for <a href="http://code.google.com/android/c2dm/signup.html">C2DM
- access</a>. We strongly recommend <a
- href="https://accounts.google.com/SignUp">creating a new Google account</a> specifically for
-connecting to C2DM. The server component in this lesson uses this <em>role
- account</em> repeatedly to authenticate with Google servers.
-</li>
-</ul>
-
-<h2 id="project">Create Your Projects</h2>
-<p>After installing the Google Plugin for Eclipse, notice that a new kind of Android project
-exists when you create a new Eclipse project: The <strong>App Engine Connected
- Android Project</strong> (under the <strong>Google</strong> project category).
-A wizard guides you through creating this project,
-during the course of which you are prompted to enter the account credentials for the role
-account you created.</p>
-
-<p class="note"><strong>Note:</strong> Remember to enter the credentials for
-your <i>role account</i> (the one you created to access C2DM services), not an
-account you'd log into as a user, or as an admin.</p>
-
-<p>Once you're done, you'll see two projects waiting for you in your
-workspace&mdash;An Android application and an App Engine application. Hooray!
-These two applications are already fully functional&mdash; the wizard has
-created a sample application which lets you authenticate to the App Engine
-application from your Android device using AccountManager (no need to type in
-your credentials), and an App Engine app that can send messages to any logged-in
-device using C2DM. In order to spin up your application and take it for a test
-drive, do the following:</p>
-
-<p>To spin up the Android application, make sure you have an AVD with a platform
-version of <em>at least</em> Android 2.2 (API Level 8). Right click on the Android project in
-Eclipse, and go to <strong>Debug As &gt; Local App Engine Connected Android
- Application</strong>. This launches the emulator in such a way that it can
-test C2DM functionality (which typically works through Google Play). It'll
-also launch a local instance of App Engine containing your awesome
-application.</p>
-
-<h2 id="data">Create the Data Layer</h2>
-
-<p>At this point you have a fully functional sample application running. Now
-it's time to start changing the code to create your own application.</p>
-
-<p>First, create the data model that defines the data shared between
-the App Engine and Android applications. To start, open up the source folder of
-your App Engine project, and navigate down to the <strong>(yourApp)-AppEngine
- &gt; src &gt; (yourapp) &gt; server</strong> package. Create a new class in there containing some data you want to
-store server-side. The code ends up looking something like this:</p>
-<pre>
-package com.cloudtasks.server;
-
-import javax.persistence.*;
-
-&#64;Entity
-public class Task {
-
- private String emailAddress;
- private String name;
- private String userId;
- private String note;
-
- &#64;Id
- &#64;GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- public Task() {
- }
-
- public String getEmailAddress() {
- return this.emailAddress;
- }
-
- public Long getId() {
- return this.id;
- }
- ...
-}
-</pre>
-<p>Note the use of annotations: <code>Entity</code>, <code>Id</code> and
-<code>GeneratedValue</code> are all part of the <a
- href="http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html">Java
- Persistence API</a>. Essentially, the <code>Entity</code> annotation goes
-above the class declaration, and indicates that this class represents an entity
-in your data layer. The <code>Id</code> and <code>GeneratedValue</code>
-annotations, respectively, indicate the field used as a lookup key for this
-class, and how that id is generated (in this case,
-<code>GenerationType.IDENTITY</code> indicates that the is generated by
-the database). You can find more on this topic in the App Engine documentation,
-on the page <a
- href="http://code.google.com/appengine/docs/java/datastore/jpa/overview.html">Using
- JPA with App Engine</a>.</p>
-
-<p>Once you've written all the classes that represent entities in your data
-layer, you need a way for the Android and App Engine applications to communicate
-about this data. This communication is enabled by creating a Remote Procedure
-Call (RPC) service.
-Typically, this involves a lot of monotonous code. Fortunately, there's an easy way! Right
-click on the server project in your App Engine source folder, and in the context
-menu, navigate to <strong>New &gt; Other</strong> and then, in the resulting
-screen, select <strong>Google &gt; RPC Service.</strong> A wizard appears, pre-populated
-with all the Entities you created in the previous step,
-which it found by seeking out the <code>&#64;Entity</code> annotation in the
-source files you added. Pretty neat, right? Click <strong>Finish</strong>, and the wizard
-creates a Service class with stub methods for the Create, Retrieve, Update and
-Delete (CRUD) operations of all your entities.</p>
-
-<h2 id="persistence">Create the Persistence Layer</h2>
-
-<p>The persistence layer is where your application data is stored
-long-term, so any information you want to keep for your users needs to go here.
-You have several options for writing your persistence layer, depending on
-what kind of data you want to store. A few of the options hosted by Google
-(though you don't have to use these services) include <a
- href="http://code.google.com/apis/storage/">Google Storage for Developers</a>
-and App Engine's built-in <a
- href="http://code.google.com/appengine/docs/java/gettingstarted/usingdatastore.html">Datastore</a>.
-The sample code for this lesson uses DataStore code.</p>
-
-<p>Create a class in your <code>com.cloudtasks.server</code> package to handle
-persistence layer input and output. In order to access the data store, use the <a
- href="http://db.apache.org/jdo/api20/apidocs/javax/jdo/PersistenceManager.html">PersistenceManager</a>
-class. You can generate an instance of this class using the PMF class in the
-<code>com.google.android.c2dm.server.PMF</code> package, and then use that to
-perform basic CRUD operations on your data store, like this:</p>
-<pre>
-/**
-* Remove this object from the data store.
-*/
-public void delete(Long id) {
- PersistenceManager pm = PMF.get().getPersistenceManager();
- try {
- Task item = pm.getObjectById(Task.class, id);
- pm.deletePersistent(item);
- } finally {
- pm.close();
- }
-}
-</pre>
-
-<p>You can also use <a
- href="http://code.google.com/appengine/docs/python/datastore/queryclass.html">Query</a>
-objects to retrieve data from your Datastore. Here's an example of a method
-that searches out an object by its ID.</p>
-
-<pre>
-public Task find(Long id) {
- if (id == null) {
- return null;
- }
-
- PersistenceManager pm = PMF.get().getPersistenceManager();
- try {
- Query query = pm.newQuery("select from " + Task.class.getName()
- + " where id==" + id.toString() + " &amp;&amp; emailAddress=='" + getUserEmail() + "'");
- List&lt;Task> list = (List&lt;Task>) query.execute();
- return list.size() == 0 ? null : list.get(0);
- } catch (RuntimeException e) {
- System.out.println(e);
- throw e;
- } finally {
- pm.close();
- }
-}
-</pre>
-
-<p>For a good example of a class that encapsulates the persistence layer for
-you, check out the <a
- href="http://code.google.com/p/cloud-tasks-io/source/browse/trunk/CloudTasks-AppEngine/src/com/cloudtasks/server/DataStore.java">DataStore</a>
-class in the Cloud Tasks app.</p>
-
-
-
-<h2 id="androidapp">Query and Update from the Android App</h2>
-
-<p>In order to keep in sync with the App Engine application, your Android application
-needs to know how to do two things: Pull data from the cloud, and send data up
-to the cloud. Much of the plumbing for this is generated by the
-plugin, but you need to wire it up to your Android user interface yourself.</p>
-
-<p>Pop open the source code for the main Activity in your project and look for
-<code>&lt;YourProjectName&gt; Activity.java</code>, then for the method
-<code>setHelloWorldScreenContent()</code>. Obviously you're not building a
-HelloWorld app, so delete this method entirely and replace it
-with something relevant. However, the boilerplate code has some very important
-characteristics. For one, the code that communicates with the cloud is wrapped
-in an {@link android.os.AsyncTask} and therefore <em>not</em> hitting the
-network on the UI thread. Also, it gives an easy template for how to access
-the cloud in your own code, using the <a
- href="http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html">RequestFactory</a>
-class generated that was auto-generated for you by the Eclipse plugin (called
-MyRequestFactory in the example below), and various {@code Request} types.</p>
-
-<p>For instance, if your server-side data model included an object called {@code
-Task} when you generated an RPC layer it automatically created a
-{@code TaskRequest} class for you, as well as a {@code TaskProxy} representing the individual
-task. In code, requesting a list of all these tasks from the server looks
-like this:</p>
-
-<pre>
-public void fetchTasks (Long id) {
- // Request is wrapped in an AsyncTask to avoid making a network request
- // on the UI thread.
- new AsyncTask&lt;Long, Void, List&lt;TaskProxy>>() {
- &#64;Override
- protected List&lt;TaskProxy> doInBackground(Long... arguments) {
- final List&lt;TaskProxy> list = new ArrayList&lt;TaskProxy>();
- MyRequestFactory factory = Util.getRequestFactory(mContext,
- MyRequestFactory.class);
- TaskRequest taskRequest = factory.taskNinjaRequest();
-
- if (arguments.length == 0 || arguments[0] == -1) {
- factory.taskRequest().queryTasks().fire(new Receiver&lt;List&lt;TaskProxy>>() {
- &#64;Override
- public void onSuccess(List&lt;TaskProxy> arg0) {
- list.addAll(arg0);
- }
- });
- } else {
- newTask = true;
- factory.taskRequest().readTask(arguments[0]).fire(new Receiver&lt;TaskProxy>() {
- &#64;Override
- public void onSuccess(TaskProxy arg0) {
- list.add(arg0);
- }
- });
- }
- return list;
- }
-
- &#64;Override
- protected void onPostExecute(List&lt;TaskProxy> result) {
- TaskNinjaActivity.this.dump(result);
- }
-
- }.execute(id);
-}
-...
-
-public void dump (List&lt;TaskProxy> tasks) {
- for (TaskProxy task : tasks) {
- Log.i("Task output", task.getName() + "\n" + task.getNote());
- }
-}
-</pre>
-
-<p>This {@link android.os.AsyncTask} returns a list of
-<code>TaskProxy</code> objects, and sends it to the debug {@code dump()} method
-upon completion. Note that if the argument list is empty, or the first argument
-is a -1, all tasks are retrieved from the server. Otherwise, only the ones with
-IDs in the supplied list are returned. All the fields you added to the task
-entity when building out the App Engine application are available via get/set
-methods in the <code>TaskProxy</code> class.</p>
-
-<p>In order to create new tasks and send them to the cloud, create a request
-object and use it to create a proxy object. Then populate the proxy object and
-call its update method. Once again, this should be done in an
-<code>AsyncTask</code> to avoid doing networking on the UI thread. The end
-result looks something like this.</p>
-
-<pre>
-new AsyncTask&lt;Void, Void, Void>() {
- &#64;Override
- protected Void doInBackground(Void... arg0) {
- MyRequestFactory factory = (MyRequestFactory)
- Util.getRequestFactory(TasksActivity.this,
- MyRequestFactory.class);
- TaskRequest request = factory.taskRequest();
-
- // Create your local proxy object, populate it
- TaskProxy task = request.create(TaskProxy.class);
- task.setName(taskName);
- task.setNote(taskDetails);
- task.setDueDate(dueDate);
-
- // To the cloud!
- request.updateTask(task).fire();
- return null;
- }
-}.execute();
-</pre>
-
-<h2 id="serverc2dm">Configure the C2DM Server-Side</h2>
-
-<p>In order to set up C2DM messages to be sent to your Android device, go back
-into your App Engine codebase, and open up the service class that was created
-when you generated your RPC layer. If the name of your project is Foo,
-this class is called FooService. Add a line to each of the methods for
-adding, deleting, or updating data so that a C2DM message is sent to the
-user's device. Here's an example of an update task:
-</p>
-
-<pre>
-public static Task updateTask(Task task) {
- task.setEmailAddress(DataStore.getUserEmail());
- task = db.update(task);
- DataStore.sendC2DMUpdate(TaskChange.UPDATE + TaskChange.SEPARATOR + task.getId());
- return task;
-}
-
-// Helper method. Given a String, send it to the current user's device via C2DM.
-public static void sendC2DMUpdate(String message) {
- UserService userService = UserServiceFactory.getUserService();
- User user = userService.getCurrentUser();
- ServletContext context = RequestFactoryServlet.getThreadLocalRequest().getSession().getServletContext();
- SendMessage.sendMessage(context, user.getEmail(), message);
-}
-</pre>
-
-<p>In the following example, a helper class, {@code TaskChange}, has been created with a few
-constants. Creating such a helper class makes managing the communication
-between App Engine and Android apps much easier. Just create it in the shared
-folder, define a few constants (flags for what kind of message you're sending
-and a seperator is typically enough), and you're done. By way of example,
-the above code works off of a {@code TaskChange} class defined as this:</p>
-
-<pre>
-public class TaskChange {
- public static String UPDATE = "Update";
- public static String DELETE = "Delete";
- public static String SEPARATOR = ":";
-}
-</pre>
-
-<h2 id="clientc2dm">Configure the C2DM Client-Side</h2>
-
-<p>In order to define the Android applications behavior when a C2DM is recieved,
-open up the <code>C2DMReceiver</code> class, and browse to the
-<code>onMessage()</code> method. Tweak this method to update based on the content
-of the message.</p>
-<pre>
-//In your C2DMReceiver class
-
-public void notifyListener(Intent intent) {
- if (listener != null) {
- Bundle extras = intent.getExtras();
- if (extras != null) {
- String message = (String) extras.get("message");
- String[] messages = message.split(Pattern.quote(TaskChange.SEPARATOR));
- listener.onTaskUpdated(messages[0], Long.parseLong(messages[1]));
- }
- }
-}
-</pre>
-
-<pre>
-// Elsewhere in your code, wherever it makes sense to perform local updates
-public void onTasksUpdated(String messageType, Long id) {
- if (messageType.equals(TaskChange.DELETE)) {
- // Delete this task from your local data store
- ...
- } else {
- // Call that monstrous Asynctask defined earlier.
- fetchTasks(id);
- }
-}
-</pre>
-<p>
-Once you have C2DM set up to trigger local updates, you're all done.
-Congratulations, you have a cloud-connected Android application!</p>
diff --git a/docs/html/training/cloudsync/backupapi.jd b/docs/html/training/cloudsync/backupapi.jd
index 30555967be38..a5436c6d2eec 100644
--- a/docs/html/training/cloudsync/backupapi.jd
+++ b/docs/html/training/cloudsync/backupapi.jd
@@ -3,8 +3,9 @@ parent.title=Syncing to the Cloud
parent.link=index.html
trainingnavtop=true
-previous.title=Syncing with App Engine
-previous.link=aesync.html
+
+next.title=Making the Most of Google Cloud Messaging
+next.link=gcm.html
@jd:body
diff --git a/docs/html/training/cloudsync/gcm.jd b/docs/html/training/cloudsync/gcm.jd
new file mode 100644
index 000000000000..dcc1b6b39850
--- /dev/null
+++ b/docs/html/training/cloudsync/gcm.jd
@@ -0,0 +1,218 @@
+page.title=Making the Most of Google Cloud Messaging
+parent.title=Syncing to the Cloud
+parent.link=index.html
+
+trainingnavtop=true
+
+previous.title=Using the Backup API
+previous.link=backupapi.html
+
+@jd:body
+
+<div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+ <ol>
+ <li><a href="#multicast">Send Multicast Messages Efficiently</a></li>
+ <li><a href="#collapse">Collapse Messages that can Be Replaced</a></li>
+ <li><a href="#embed">Embed Data Directly in the GCM Message</a></li>
+ <li><a href="#react">React Intelligently to GCM Messages</a></li>
+ </ol>
+ <h2>You should also read</h2>
+ <ul>
+ <li><a href="http://developer.android.com/guide/google/gcm/index.html">Google
+ Cloud Messaging for Android</a></li>
+ </ul>
+ </div>
+</div>
+
+<p>Google Cloud Messaging (GCM) is a free service for sending
+messages to Android devices. GCM messaging can greatly enhance the user
+experience. Your application can stay up to date without wasting battery power
+on waking up the radio and polling the server when there are no updates. Also,
+GCM allows you to attach up to 1,000 recipients to a single message, letting you easily contact
+large user bases quickly when appropriate, while minimizing the work load on
+your server.</p>
+
+<p>This lesson covers some of the best practices
+for integrating GCM into your application, and assumes you are already familiar
+with basic implementation of this service. If this is not the case, you can read the <a
+ href="http://developer.google.com/android/gcm/demo">GCM
+ Tutorial</a>.</p>
+
+<h2 id="multicast">Send Multicast Messages Efficiently</h2>
+<p>One of the most useful features in GCM is support for up to 1,000 recipients for
+a single message. This capability makes it much easier to send out important messages to
+your entire user base. For instance, let's say you had a message that needed to
+be sent to 1,000,000 of your users, and your server could handle sending out
+about 500 messages per second. If you send each message with only a single
+recipient, it would take 1,000,000/500 = 2,000 seconds, or around half an hour.
+However, attaching 1,000 recipients to each message, the total time required to
+send a message out to 1,000,000 recipients becomes (1,000,000/1,000) / 500 = 2
+seconds. This is not only useful, but important for timely data, such as natural
+disaster alerts or sports scores, where a 30 minute interval might render the
+information useless.</p>
+
+<p>Taking advantage of this functionality is easy. If you're using the <a
+ href="http://developer.android.com/guide/google/gcm/gs.html#libs">GCM helper
+ library</a> for Java, simply provide a <code>List<String></code> collection of
+registration IDs to the <code>send</code> or <code>sendNoRetry</code> method,
+instead of a single registration ID.</p>
+
+<pre>
+// This method name is completely fabricated, but you get the idea.
+List<String> regIds = whoShouldISendThisTo(message);
+
+// If you want the SDK to automatically retry a certain number of times, use the
+// standard send method.
+MulticastResult result = sender.send(message, regIds, 5);
+
+// Otherwise, use sendNoRetry.
+MulticastResult result = sender.sendNoRetry(message, regIds);
+</pre>
+
+<p>For those implementing GCM support in a language other than Java, construct
+an HTTP POST request with the following headers:</p>
+<ul>
+ <li><code>Authorization: key=YOUR_API_KEY</code></li>
+ <li><code>Content-type: application/json</code></li>
+</ul>
+
+<p>Then encode the parameters you want into a JSON object, listing all the
+registration IDs under the key <code>registration_ids</code>. The snippet below
+serves as an example. All parameters except <code>registration_ids</code> are
+optional, and the items nested in <code>data</code> represent the user-defined payload, not
+GCM-defined parameters. The endpoint for this HTTP POST message will be
+<code>https://android.googleapis.com/gcm/send</code>.</p>
+
+<pre>
+{ "collapse_key": "score_update",
+ "time_to_live": 108,
+ "delay_while_idle": true,
+ "data": {
+ "score": "4 x 8",
+ "time": "15:16.2342"
+ },
+ "registration_ids":["4", "8", "15", "16", "23", "42"]
+}
+</pre>
+
+<p>For a more thorough overview of the format of multicast GCM messages, see the <a
+ href="http://developer.android.com/guide/google/gcm/gcm.html#send-msg">Sending
+ Messages</a> section of the GCM guide.</pre>
+
+<h2 id="collapse">Collapse Messages that Can Be Replaced</h2>
+<p>GCM messages are often a tickle, telling the mobile application to
+contact the server for fresh data. In GCM, it's possible (and recommended) to
+create collapsible messages for this situation, wherein new messages replace
+older ones. Let's take the example
+of sports scores. If you send out a message to all users following a certain
+game with the updated score, and then 15 minutes later an updated score message
+goes out, the earlier one no longer matters. For any users who haven't received
+the first message yet, there's no reason to send both, and force the device to
+react (and possibly alert the user) twice when only one of the messages is still
+important.</p>
+
+<p>When you define a collapse key, when multiple messages are queued up in the GCM
+servers for the same user, only the last one with any given collapse key is
+delivered. For a situation like with sports scores, this saves the device from
+doing needless work and potentially over-notifying the user. For situations
+that involve a server sync (like checking email), this can cut down on the
+number of syncs the device has to do. For instance, if there are 10 emails
+waiting on the server, and ten "new email" GCM tickles have been sent to the
+device, it only needs one, since it should only sync once.</p>
+
+<p>In order to use this feature, just add a collapse key to your outgoing
+message. If you're using the GCM helper library, use the Message class's <code>collapseKey(String key)</code> method.</p>
+
+<pre>
+Message message = new Message.Builder(regId)
+ .collapseKey("game4_scores") // The key for game 4.
+ .ttl(600) // Time in seconds to keep message queued if device offline.
+ .delayWhileIdle(true) // Wait for device to become active before sending.
+ .addPayload("key1", "value1")
+ .addPayload("key2", "value2")
+ .build();
+</pre>
+
+<p>If not using the helper library, simply add a variable to the
+POST header you're constructing, with <code>collapse_key</code> as the field
+name, and the string you're using for that set of updates as the value.</p>
+
+
+
+<h2 id="embed">Embed Data Directly in the GCM Message</h2>
+<p>Often, GCM messages are meant to be a tickle, or indication to the device
+that there's fresh data waiting on a server somewhere. However, a GCM message
+can be up to 4kb in size, so sometimes it makes sense to simply send the
+data within the GCM message itself, so that the device doesn't need to contact the
+server at all. Consider this approach for situations where all of the
+following statements are true:
+<ul>
+ <li>The total data fits inside the 4kb limit.</li>
+ <li>Each message is important, and should be preserved.</li>
+ <li>It doesn't make sense to collapse multiple GCM messages into a single
+ "new data on the server" tickle.</li>
+</ul>
+
+<p>For instance, short messages or encoded player moves
+in a turn-based network game are examples of good use-cases for data to embed directly
+into a GCM message. Email is an example of a bad use-case, since messages are
+often larger than 4kb,
+and users don't need a GCM message for each email waiting for them on
+the server.</p>
+
+<p>Also consider this approach when sending
+multicast messages, so you don't tell every device across your user base to hit
+your server for updates simultaneously.</p>
+<p>This strategy isn't appropriate for sending large amounts of data, for a few
+reasons:</p>
+<ul>
+ <li>Rate limits are in place to prevent malicious or poorly coded apps from spamming an
+ individual device with messages.</li>
+ <li>Messages aren't guaranteed to arrive in-order.</li>
+ <li>Messages aren't guaranteed to arrive as fast as you send them out. Even
+ if the device receives one GCM message a second, at a max of 1K, that's 8kbps, or
+ about the speed of home dial-up internet in the early 1990's. Your app rating
+ on Google Play will reflect having done that to your users.</p>
+</ul>
+
+<p>When used appropriately, directly embedding data in the GCM message can speed
+up the perceived speediness of your application, by letting it skip a round trip
+to the server.</p>
+
+<h2 id="react">React Intelligently to GCM Messages</h2>
+<p>Your application should not only react to incoming GCM messages, but react
+<em>intelligently</em>. How to react depends on the context.</p>
+
+<h3>Don't be irritating</h3>
+<p>When it comes to alerting your user of fresh data, it's easy to cross the line
+from "useful" to "annoying". If your application uses status bar notifications,
+<a
+ href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating">update
+ your existing notification</a> instead of creating a second one. If you
+beep or vibrate to alert the user, consider setting up a timer. Don't let the
+application alert more than once a minute, lest users be tempted to uninstall
+your application, turn the device off, or toss it in a nearby river.</p>
+
+<h3>Sync smarter, not harder</h3>
+<p>When using GCM as an indicator to the device that data needs to be downloaded
+from the server, remember you have 4kb of metadata you can send along to
+help your application be smart about it. For instance, if you have a feed
+reading app, and your user has 100 feeds that they follow, help the device be
+smart about what it downloads from the server! Look at the following examples
+of what metadata is sent to your application in the GCM payload, and how the application
+can react:</p>
+<ul>
+ <li><code>refresh</code> &mdash; Your app basically got told to request a dump of
+ every feed it follows. Your app would either need to send feed requests to 100 different servers, or
+ if you have an aggregator on your server, send a request to retrieve, bundle
+ and
+ transmit recent data from 100 different feeds, every time one updates.</li>
+ <li><code>refresh</code>, <code>feedID</code> &mdash; Better: Your app knows to check
+ a specific feed for updates.</li>
+ <li><code>refresh</code>, <code>feedID</code>, <code>timestamp</code> &mdash;
+ Best: If the user happened to manually refresh before the GCM message
+ arrived, the application can compare timestamps of the most recent post, and
+ determine that it <em>doesn't need to do anything</em>.
+</ul>
diff --git a/docs/html/training/cloudsync/index.jd b/docs/html/training/cloudsync/index.jd
index e53844b5015c..91885e85ab56 100644
--- a/docs/html/training/cloudsync/index.jd
+++ b/docs/html/training/cloudsync/index.jd
@@ -2,8 +2,8 @@ page.title=Syncing to the Cloud
trainingnavtop=true
startpage=true
-next.title=Syncing with App Engine
-next.link=aesync.html
+next.title=Making the Most of Google Cloud Messaging
+next.link=gcm.html
@jd:body
@@ -21,14 +21,13 @@ installing your application on a new device.
<h2>Lessons</h2>
<dl>
- <dt><strong><a href="aesync.html">Syncing with App Engine.</a></strong></dt>
- <dd>Learn how to create a paired App Engine app and Android app which share a
- data model, authenticates using the AccountManager, and communicate with each
- other via REST and C2DM.</dd>
- <dt><strong><a href="backupapi.html">Using the Backup
- API</a></strong></dt>
+ <dt><strong><a href="backupapi.html">Using the Backup API</a></strong></dt>
<dd>Learn how to integrate the Backup API into your Android Application, so
that user data such as preferences, notes, and high scores update seamlessly
across all of a user's devices</dd>
+ <dt><strong><a href="gcm.html">Making the Most of Google Cloud Messaging</a></strong></dt>
+ <dd>Learn how to efficiently send multicast messages, react intelligently to
+ incoming Google Cloud Messaging (GCM) messages, and use GCM messages to
+ efficiently sync with the server.</dd>
</dl>
diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs
index 77a68371a885..37b69d4c8c70 100644
--- a/docs/html/training/training_toc.cs
+++ b/docs/html/training/training_toc.cs
@@ -203,14 +203,14 @@
<span class="en">Syncing to the Cloud</span>
</a></div>
<ul>
- <li><a href="<?cs var:toroot ?>training/cloudsync/aesync.html">
- <span class="en">Syncing with App Engine</span>
- </a>
- </li>
<li><a href="<?cs var:toroot ?>training/cloudsync/backupapi.html">
<span class="en">Using the Backup API</span>
</a>
</li>
+ <li><a href="<?cs var:toroot ?>training/cloudsync/gcm.html">
+ <span class="en">Making the Most of Google Cloud Messaging</span>
+ </a>
+ </li>
</ul>
</li>
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 8c8ff4dcae14..09f69527cd41 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -718,7 +718,7 @@ nAllocationRead_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jintAr
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
jsize length = _env->GetArrayLength(data);
- rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
+ rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(int));
_env->ReleaseIntArrayElements(data, ptr, 0);
}
@@ -729,7 +729,7 @@ nAllocationRead_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jshort
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jshort *ptr = _env->GetShortArrayElements(data, NULL);
jsize length = _env->GetArrayLength(data);
- rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
+ rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(short));
_env->ReleaseShortArrayElements(data, ptr, 0);
}
@@ -740,7 +740,7 @@ nAllocationRead_b(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jbyteA
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jbyte *ptr = _env->GetByteArrayElements(data, NULL);
jsize length = _env->GetArrayLength(data);
- rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
+ rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(char));
_env->ReleaseByteArrayElements(data, ptr, 0);
}
@@ -751,7 +751,7 @@ nAllocationRead_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jfloat
LOG_API("nAllocationRead_f, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
jsize length = _env->GetArrayLength(data);
- rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
+ rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(float));
_env->ReleaseFloatArrayElements(data, ptr, 0);
}
diff --git a/include/androidfw/PowerManager.h b/include/androidfw/PowerManager.h
index 59e993abfb9c..ba98db07ca69 100644
--- a/include/androidfw/PowerManager.h
+++ b/include/androidfw/PowerManager.h
@@ -21,11 +21,11 @@
namespace android {
enum {
- POWER_MANAGER_OTHER_EVENT = 0,
- POWER_MANAGER_BUTTON_EVENT = 1,
- POWER_MANAGER_TOUCH_EVENT = 2,
+ USER_ACTIVITY_EVENT_OTHER = 0,
+ USER_ACTIVITY_EVENT_BUTTON = 1,
+ USER_ACTIVITY_EVENT_TOUCH = 2,
- POWER_MANAGER_LAST_EVENT = POWER_MANAGER_TOUCH_EVENT, // Last valid event code.
+ USER_ACTIVITY_EVENT_LAST = USER_ACTIVITY_EVENT_TOUCH, // Last valid event code.
};
} // namespace android
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 7161c589b191..76321be271d3 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -63,7 +63,7 @@ const char* DisplayList::OP_NAMES[] = {
"DrawPoints",
"DrawTextOnPath",
"DrawPosText",
- "DrawGeneralText",
+ "DrawText",
"ResetShader",
"SetupShader",
"ResetColorFilter",
@@ -593,7 +593,7 @@ void DisplayList::output(OpenGLRenderer& renderer, uint32_t level) {
text.text(), text.length(), count, paint);
}
break;
- case DrawGeneralText: {
+ case DrawText: {
getText(&text);
int count = getInt();
int positionsCount = 0;
@@ -1221,7 +1221,7 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag
positions, paint);
}
break;
- case DrawGeneralText: {
+ case DrawText: {
getText(&text);
int32_t count = getInt();
float x = getFloat();
@@ -1232,7 +1232,7 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag
float length = getFloat();
DISPLAY_LIST_LOGD("%s%s %s, %d, %d, %.2f, %.2f, %p, %.2f", (char*) indent,
OP_NAMES[op], text.text(), text.length(), count, x, y, paint, length);
- drawGlStatus |= renderer.drawGeneralText(text.text(), text.length(), count,
+ drawGlStatus |= renderer.drawText(text.text(), text.length(), count,
x, y, positions, paint, length);
}
break;
@@ -1712,7 +1712,7 @@ status_t DisplayListRenderer::drawPosText(const char* text, int bytesCount, int
return DrawGlInfo::kStatusDone;
}
-status_t DisplayListRenderer::drawGeneralText(const char* text, int bytesCount, int count,
+status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int count,
float x, float y, const float* positions, SkPaint* paint, float length) {
if (!text || count <= 0) return DrawGlInfo::kStatusDone;
@@ -1733,7 +1733,7 @@ status_t DisplayListRenderer::drawGeneralText(const char* text, int bytesCount,
reject = quickReject(x, y + metrics.fTop, x + length, y + metrics.fBottom);
}
- uint32_t* location = addOp(DisplayList::DrawGeneralText, reject);
+ uint32_t* location = addOp(DisplayList::DrawText, reject);
addText(text, bytesCount);
addInt(count);
addFloat(x);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index f3041dd8be7e..60a40c6b76be 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -105,7 +105,7 @@ public:
DrawPoints,
DrawTextOnPath,
DrawPosText,
- DrawGeneralText,
+ DrawText,
ResetShader,
SetupShader,
ResetColorFilter,
@@ -603,7 +603,7 @@ public:
float hOffset, float vOffset, SkPaint* paint);
virtual status_t drawPosText(const char* text, int bytesCount, int count,
const float* positions, SkPaint* paint);
- virtual status_t drawGeneralText(const char* text, int bytesCount, int count,
+ virtual status_t drawText(const char* text, int bytesCount, int count,
float x, float y, const float* positions, SkPaint* paint, float length);
virtual void resetShader();
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 07281ccf19c9..d0d5af5e5b2d 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2421,7 +2421,7 @@ status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count
return DrawGlInfo::kStatusDrew;
}
-status_t OpenGLRenderer::drawGeneralText(const char* text, int bytesCount, int count,
+status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
float x, float y, const float* positions, SkPaint* paint, float length) {
if (text == NULL || count == 0 || mSnapshot->isIgnored() ||
(paint->getAlpha() * mSnapshot->alpha == 0 && paint->getXfermode() == NULL)) {
@@ -2455,7 +2455,7 @@ status_t OpenGLRenderer::drawGeneralText(const char* text, int bytesCount, int c
}
#if DEBUG_GLYPHS
- ALOGD("OpenGLRenderer drawGeneralText() with FontID=%d",
+ ALOGD("OpenGLRenderer drawText() with FontID=%d",
SkTypeface::UniqueID(paint->getTypeface()));
#endif
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 378fc8c1e3be..51683e1e0942 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -142,7 +142,7 @@ public:
float hOffset, float vOffset, SkPaint* paint);
virtual status_t drawPosText(const char* text, int bytesCount, int count,
const float* positions, SkPaint* paint);
- virtual status_t drawGeneralText(const char* text, int bytesCount, int count, float x, float y,
+ virtual status_t drawText(const char* text, int bytesCount, int count, float x, float y,
const float* positions, SkPaint* paint, float length = -1.0f);
virtual void resetShader();
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index d2a829871367..84fb0ddbcee0 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -3660,9 +3660,10 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator();
while(stackIterator.hasNext()) {
FocusStackEntry fse = stackIterator.next();
- pw.println(" source:" + fse.mSourceRef + " -- client: " + fse.mClientId
+ pw.println(" source:" + fse.mSourceRef + " -- client: " + fse.mClientId
+ " -- duration: " + fse.mFocusChangeType
- + " -- uid: " + fse.mCallingUid);
+ + " -- uid: " + fse.mCallingUid
+ + " -- stream: " + fse.mStreamType);
}
}
}
@@ -4022,7 +4023,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
startVoiceBasedInteractions(needWakeLock);
break;
case VOICEBUTTON_ACTION_SIMULATE_KEY_PRESS:
- if (DEBUG_RC) Log.v(TAG, " send simulated key event");
+ if (DEBUG_RC) Log.v(TAG, " send simulated key event, wakelock=" + needWakeLock);
sendSimulatedMediaButtonEvent(keyEvent, needWakeLock);
break;
}
@@ -4654,17 +4655,40 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
clearRemoteControlDisplay_syncAfRcs();
return;
}
- // if the top of the two stacks belong to different packages, there is a mismatch, clear
+
+ // determine which entry in the AudioFocus stack to consider, and compare against the
+ // top of the stack for the media button event receivers : simply using the top of the
+ // stack would make the entry disappear from the RemoteControlDisplay in conditions such as
+ // notifications playing during music playback.
+ // crawl the AudioFocus stack until an entry is found with the following characteristics:
+ // - focus gain on STREAM_MUSIC stream
+ // - non-transient focus gain on a stream other than music
+ FocusStackEntry af = null;
+ Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator();
+ while(stackIterator.hasNext()) {
+ FocusStackEntry fse = (FocusStackEntry)stackIterator.next();
+ if ((fse.mStreamType == AudioManager.STREAM_MUSIC)
+ || (fse.mFocusChangeType == AudioManager.AUDIOFOCUS_GAIN)) {
+ af = fse;
+ break;
+ }
+ }
+ if (af == null) {
+ clearRemoteControlDisplay_syncAfRcs();
+ return;
+ }
+
+ // if the audio focus and RC owners belong to different packages, there is a mismatch, clear
if ((mRCStack.peek().mCallingPackageName != null)
- && (mFocusStack.peek().mPackageName != null)
+ && (af.mPackageName != null)
&& !(mRCStack.peek().mCallingPackageName.compareTo(
- mFocusStack.peek().mPackageName) == 0)) {
+ af.mPackageName) == 0)) {
clearRemoteControlDisplay_syncAfRcs();
return;
}
// if the audio focus didn't originate from the same Uid as the one in which the remote
// control information will be retrieved, clear
- if (mRCStack.peek().mCallingUid != mFocusStack.peek().mCallingUid) {
+ if (mRCStack.peek().mCallingUid != af.mCallingUid) {
clearRemoteControlDisplay_syncAfRcs();
return;
}
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index 9f10cb037442..687d3a52810f 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -295,7 +295,7 @@ final public class MediaExtractor {
* Returns true iff we are caching data and the cache has reached the
* end of the data stream (for now, a future seek may of course restart
* the fetching of data).
- * This API only returns a meaningful result if {link #getCachedDuration}
+ * This API only returns a meaningful result if {@link #getCachedDuration}
* indicates the presence of a cache, i.e. does NOT return -1.
*/
public native boolean hasCacheReachedEndOfStream();
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index a25d9341cf65..7693e8091d23 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -706,7 +706,7 @@ public class MediaPlayer
* surface rendering area. When the surface has the same aspect ratio
* as the content, the aspect ratio of the content is maintained;
* otherwise, the aspect ratio of the content is not maintained when video
- * is being rendered. Unlike {@ #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING},
+ * is being rendered. Unlike {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING},
* there is no content cropping with this video scaling mode.
*/
public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1;
diff --git a/media/libstagefright/codecs/aacdec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/aacdec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/aacdec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/aacdec/NOTICE b/media/libstagefright/codecs/aacdec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/aacdec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/aacenc/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/aacenc/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/aacenc/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/aacenc/NOTICE b/media/libstagefright/codecs/aacenc/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/aacenc/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/aacenc/SampleCode/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/aacenc/SampleCode/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/aacenc/SampleCode/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/aacenc/SampleCode/NOTICE b/media/libstagefright/codecs/aacenc/SampleCode/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/aacenc/SampleCode/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrnb/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrnb/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrnb/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrnb/NOTICE b/media/libstagefright/codecs/amrnb/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrnb/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrnb/common/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrnb/common/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrnb/common/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrnb/common/NOTICE b/media/libstagefright/codecs/amrnb/common/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrnb/common/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrnb/dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrnb/dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrnb/dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrnb/dec/NOTICE b/media/libstagefright/codecs/amrnb/dec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrnb/dec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrnb/enc/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrnb/enc/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrnb/enc/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrnb/enc/NOTICE b/media/libstagefright/codecs/amrnb/enc/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrnb/enc/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrwb/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrwb/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrwb/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrwb/NOTICE b/media/libstagefright/codecs/amrwb/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrwb/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrwbenc/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrwbenc/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrwbenc/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrwbenc/NOTICE b/media/libstagefright/codecs/amrwbenc/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrwbenc/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/amrwbenc/SampleCode/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/amrwbenc/SampleCode/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/amrwbenc/SampleCode/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/amrwbenc/SampleCode/NOTICE b/media/libstagefright/codecs/amrwbenc/SampleCode/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/amrwbenc/SampleCode/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/avc/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/avc/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/avc/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/avc/NOTICE b/media/libstagefright/codecs/avc/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/avc/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/avc/common/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/avc/common/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/avc/common/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/avc/common/NOTICE b/media/libstagefright/codecs/avc/common/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/avc/common/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/avc/enc/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/avc/enc/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/avc/enc/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/avc/enc/NOTICE b/media/libstagefright/codecs/avc/enc/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/avc/enc/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/common/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/common/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/common/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/common/NOTICE b/media/libstagefright/codecs/common/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/common/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/g711/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/g711/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/g711/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/g711/NOTICE b/media/libstagefright/codecs/g711/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/g711/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/g711/dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/g711/dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/g711/dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/g711/dec/NOTICE b/media/libstagefright/codecs/g711/dec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/g711/dec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/m4v_h263/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/m4v_h263/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/m4v_h263/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/m4v_h263/NOTICE b/media/libstagefright/codecs/m4v_h263/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/m4v_h263/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/m4v_h263/dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/m4v_h263/dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/m4v_h263/dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/m4v_h263/dec/NOTICE b/media/libstagefright/codecs/m4v_h263/dec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/m4v_h263/dec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/m4v_h263/enc/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/m4v_h263/enc/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/m4v_h263/enc/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/m4v_h263/enc/NOTICE b/media/libstagefright/codecs/m4v_h263/enc/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/m4v_h263/enc/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/mp3dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/mp3dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/mp3dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/mp3dec/NOTICE b/media/libstagefright/codecs/mp3dec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/mp3dec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/on2/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/on2/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/on2/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/on2/NOTICE b/media/libstagefright/codecs/on2/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/on2/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/on2/dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/on2/dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/on2/dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/on2/dec/NOTICE b/media/libstagefright/codecs/on2/dec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/on2/dec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/vorbis/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/vorbis/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/vorbis/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/vorbis/NOTICE b/media/libstagefright/codecs/vorbis/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/vorbis/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/media/libstagefright/codecs/vorbis/dec/MODULE_LICENSE_APACHE2 b/media/libstagefright/codecs/vorbis/dec/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/media/libstagefright/codecs/vorbis/dec/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/media/libstagefright/codecs/vorbis/dec/NOTICE b/media/libstagefright/codecs/vorbis/dec/NOTICE
deleted file mode 100644
index d64569567334..000000000000
--- a/media/libstagefright/codecs/vorbis/dec/NOTICE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 637c40384087..10849f6ea5b0 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -84,26 +84,6 @@
</intent-filter>
</receiver>
- <!-- should you need to launch the screensaver, this is a good way to do it -->
- <activity android:name=".DreamsDockLauncher"
- android:theme="@android:style/Theme.Dialog"
- android:label="@string/dreams_dock_launcher">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
-
- <!-- launch screensaver on (desk) dock event -->
- <receiver android:name=".DreamsDockLauncher$DockEventReceiver"
- android:exported="true"
- >
- <intent-filter>
- <action android:name="android.intent.action.DOCK_EVENT" />
- </intent-filter>
- </receiver>
-
-
<activity android:name=".usb.UsbStorageActivity"
android:label="@*android:string/usb_storage_activity_title"
android:excludeFromRecents="true">
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index 47e5b7194488..5841978c2cd0 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -40,24 +40,34 @@
android:visibility="invisible"
/>
- <FrameLayout
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/close_handle_underlap"
+ android:orientation="vertical"
>
<include layout="@layout/status_bar_expanded_header"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_panel_header_height"
/>
-
+
+ <TextView
+ android:id="@+id/emergency_calls_only"
+ android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network.EmergencyOnly"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:paddingBottom="4dp"
+ android:gravity="center"
+ android:visibility="gone"
+ />
+
<ScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdge="none"
- android:overScrollMode="ifContentScrolls"
- android:layout_marginTop="@dimen/notification_panel_header_height"
+ android:overScrollMode="always"
>
<com.android.systemui.statusbar.policy.NotificationRowLayout
android:id="@+id/latestItems"
@@ -66,7 +76,7 @@
systemui:rowHeight="@dimen/notification_row_min_height"
/>
</ScrollView>
- </FrameLayout>
+ </LinearLayout>
<com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 1d5bf3c70713..2564003b2914 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -67,6 +67,9 @@
<item name="android:textColor">#999999</item>
</style>
+ <style name="TextAppearance.StatusBar.Expanded.Network.EmergencyOnly">
+ </style>
+
<style name="Animation" />
<style name="Animation.ShirtPocketPanel">
diff --git a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java b/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java
deleted file mode 100644
index 73249b44b28e..000000000000
--- a/packages/SystemUI/src/com/android/systemui/DreamsDockLauncher.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.android.systemui;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.provider.Settings;
-import android.util.Slog;
-
-public class DreamsDockLauncher extends Activity {
- private static final String TAG = "DreamsDockLauncher";
-
- // Launch the screen saver if started as an activity.
- @Override
- protected void onCreate (Bundle icicle) {
- super.onCreate(icicle);
- launchDream(this);
- finish();
- }
-
- private static void launchDream(Context context) {
- try {
- String component = Settings.Secure.getString(
- context.getContentResolver(), Settings.Secure.SCREENSAVER_COMPONENT);
- if (component == null) {
- component = context.getResources().getString(
- com.android.internal.R.string.config_defaultDreamComponent);
- }
- if (component != null) {
- // dismiss the notification shade, recents, etc.
- context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
-
- ComponentName cn = ComponentName.unflattenFromString(component);
- Intent zzz = new Intent(Intent.ACTION_MAIN)
- .setComponent(cn)
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
- | Intent.FLAG_ACTIVITY_NO_USER_ACTION
- | Intent.FLAG_FROM_BACKGROUND
- | Intent.FLAG_ACTIVITY_NO_HISTORY
- );
- Slog.v(TAG, "Starting screen saver on dock event: " + component);
- context.startActivity(zzz);
- } else {
- Slog.e(TAG, "Couldn't start screen saver: none selected");
- }
- } catch (android.content.ActivityNotFoundException exc) {
- // no screensaver? give up
- Slog.e(TAG, "Couldn't start screen saver: none installed");
- }
- }
-
- // Trap low-level dock events and launch the screensaver.
- public static class DockEventReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- final boolean activateOnDock = 0 != Settings.Secure.getInt(
- context.getContentResolver(),
- Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, 0);
-
- if (!activateOnDock) return;
-
- if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())) {
- Bundle extras = intent.getExtras();
- int state = extras
- .getInt(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED);
- if (state == Intent.EXTRA_DOCK_STATE_DESK
- || state == Intent.EXTRA_DOCK_STATE_LE_DESK
- || state == Intent.EXTRA_DOCK_STATE_HE_DESK) {
- launchDream(context);
- }
- }
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 00d6d6f28c18..63c9b79d05cb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -22,6 +22,7 @@ import android.animation.ObjectAnimator;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
@@ -431,13 +432,14 @@ public class NavigationBarView extends LinearLayout {
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("NavigationBarView {");
final Rect r = new Rect();
+ final Point size = new Point();
+ mDisplay.getRealSize(size);
pw.println(String.format(" this: " + PhoneStatusBar.viewInfo(this)
+ " " + visibilityToString(getVisibility())));
getWindowVisibleDisplayFrame(r);
- final boolean offscreen = r.right > mDisplay.getRawWidth()
- || r.bottom > mDisplay.getRawHeight();
+ final boolean offscreen = r.right > size.x || r.bottom > size.y;
pw.println(" window: "
+ r.toShortString()
+ " " + visibilityToString(getWindowVisibility())
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 25de109cf964..16e934525115 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -186,6 +186,7 @@ public class PhoneStatusBar extends BaseStatusBar {
private TextView mCarrierLabel;
private boolean mCarrierLabelVisible = false;
private int mCarrierLabelHeight;
+ private TextView mEmergencyCallLabel;
// drag bar
CloseDragHandle mCloseView;
@@ -402,14 +403,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
mPile.setLayoutTransitionsEnabled(false);
mPile.setLongPressListener(getNotificationLongClicker());
- if (SHOW_CARRIER_LABEL) {
- mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
- @Override
- public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
- updateCarrierLabelVisibility(false);
- }
- });
- }
mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);
mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
@@ -422,9 +415,6 @@ public class PhoneStatusBar extends BaseStatusBar {
mSettingsButton.setOnClickListener(mSettingsButtonListener);
mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button);
- mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
- mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
-
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns
@@ -453,7 +443,21 @@ public class PhoneStatusBar extends BaseStatusBar {
mNetworkController.addSignalCluster(signalCluster);
signalCluster.setNetworkController(mNetworkController);
+ mEmergencyCallLabel = (TextView)mStatusBarWindow.findViewById(R.id.emergency_calls_only);
+ if (mEmergencyCallLabel != null) {
+ mNetworkController.addEmergencyLabelView(mEmergencyCallLabel);
+ mEmergencyCallLabel.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ updateCarrierLabelVisibility(false);
+ }});
+ }
+
if (SHOW_CARRIER_LABEL) {
+ mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
+ mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);
+
// for mobile devices, we always show mobile connection info here (SPN/PLMN)
// for other devices, we show whatever network is connected
if (mNetworkController.hasMobileDataFeature()) {
@@ -461,6 +465,14 @@ public class PhoneStatusBar extends BaseStatusBar {
} else {
mNetworkController.addCombinedLabelView(mCarrierLabel);
}
+
+ // set up the dynamic hide/show of the label
+ mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
+ @Override
+ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
+ updateCarrierLabelVisibility(false);
+ }
+ });
}
// final ImageView wimaxRSSI =
@@ -904,9 +916,11 @@ public class PhoneStatusBar extends BaseStatusBar {
Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
}
-
- final boolean makeVisible =
- mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
+
+ final boolean emergencyCallsShownElsewhere = mEmergencyCallLabel != null;
+ final boolean makeVisible =
+ !(emergencyCallsShownElsewhere && mNetworkController.isEmergencyOnly())
+ && mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
if (force || mCarrierLabelVisible != makeVisible) {
mCarrierLabelVisible = makeVisible;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index 4fc6940efc64..8711a8d4f802 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -146,6 +146,7 @@ public class NetworkController extends BroadcastReceiver {
ArrayList<TextView> mCombinedLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mMobileLabelViews = new ArrayList<TextView>();
ArrayList<TextView> mWifiLabelViews = new ArrayList<TextView>();
+ ArrayList<TextView> mEmergencyLabelViews = new ArrayList<TextView>();
ArrayList<SignalCluster> mSignalClusters = new ArrayList<SignalCluster>();
int mLastPhoneSignalIconId = -1;
int mLastDataDirectionIconId = -1;
@@ -246,6 +247,10 @@ public class NetworkController extends BroadcastReceiver {
return mHasMobileDataFeature;
}
+ public boolean isEmergencyOnly() {
+ return (mServiceState != null && mServiceState.isEmergencyOnly());
+ }
+
public void addPhoneSignalIconView(ImageView v) {
mPhoneSignalIconViews.add(v);
}
@@ -285,6 +290,10 @@ public class NetworkController extends BroadcastReceiver {
mWifiLabelViews.add(v);
}
+ public void addEmergencyLabelView(TextView v) {
+ mEmergencyLabelViews.add(v);
+ }
+
public void addSignalCluster(SignalCluster cluster) {
mSignalClusters.add(cluster);
refreshSignalCluster(cluster);
@@ -920,6 +929,7 @@ public class NetworkController extends BroadcastReceiver {
String wifiLabel = "";
String mobileLabel = "";
int N;
+ final boolean emergencyOnly = isEmergencyOnly();
if (!mHasMobileDataFeature) {
mDataSignalIconId = mPhoneSignalIconId = 0;
@@ -935,8 +945,8 @@ public class NetworkController extends BroadcastReceiver {
if (mDataConnected) {
mobileLabel = mNetworkName;
- } else if (mConnected || mServiceState.isEmergencyOnly()) {
- if (hasService() || mServiceState.isEmergencyOnly()) {
+ } else if (mConnected || emergencyOnly) {
+ if (hasService() || emergencyOnly) {
// The isEmergencyOnly test covers the case of a phone with no SIM
mobileLabel = mNetworkName;
} else {
@@ -1081,6 +1091,7 @@ public class NetworkController extends BroadcastReceiver {
+ " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId)
+ " mobileLabel=" + mobileLabel
+ " wifiLabel=" + wifiLabel
+ + " emergencyOnly=" + emergencyOnly
+ " combinedLabel=" + combinedLabel
+ " mAirplaneMode=" + mAirplaneMode
+ " mDataActivity=" + mDataActivity
@@ -1246,6 +1257,18 @@ public class NetworkController extends BroadcastReceiver {
v.setVisibility(View.VISIBLE);
}
}
+
+ // e-call label
+ N = mEmergencyLabelViews.size();
+ for (int i=0; i<N; i++) {
+ TextView v = mEmergencyLabelViews.get(i);
+ if (!emergencyOnly) {
+ v.setVisibility(View.GONE);
+ } else {
+ v.setText(mobileLabel); // comes from the telephony stack
+ v.setVisibility(View.VISIBLE);
+ }
+ }
}
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index cca9cbb4656a..15d53fb77c77 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -340,8 +340,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean mSystemReady;
boolean mSystemBooted;
boolean mHdmiPlugged;
- int mExternalDisplayWidth;
- int mExternalDisplayHeight;
int mUiMode;
int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED;
int mLidOpenRotation;
@@ -998,9 +996,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
- mExternalDisplayWidth = mDisplay.getRawExternalWidth();
- mExternalDisplayHeight = mDisplay.getRawExternalHeight();
-
mStatusBarHeight = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.status_bar_height);
@@ -3026,21 +3021,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
KeyEvent.KEYCODE_POWER, mDockMode != Intent.EXTRA_DOCK_STATE_UNDOCKED);
} else {
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
- LocalPowerManager.BUTTON_EVENT);
+ PowerManager.USER_ACTIVITY_EVENT_BUTTON);
}
} else if (!mLidControlsSleep) {
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
- LocalPowerManager.OTHER_EVENT);
+ PowerManager.USER_ACTIVITY_EVENT_OTHER);
}
}
void setHdmiPlugged(boolean plugged) {
if (mHdmiPlugged != plugged) {
mHdmiPlugged = plugged;
- if (plugged && mDisplay != null) {
- mExternalDisplayWidth = mDisplay.getRawExternalWidth();
- mExternalDisplayHeight = mDisplay.getRawExternalHeight();
- }
updateRotation(true, true);
Intent intent = new Intent(ACTION_HDMI_PLUGGED);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
@@ -4328,7 +4319,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mPowerManager.isScreenOn()) {
if (mKeyguardMediator != null && !mKeyguardMediator.isShowingAndNotHidden()) {
long curTime = SystemClock.uptimeMillis();
- mPowerManager.userActivity(curTime, false, LocalPowerManager.OTHER_EVENT);
+ mPowerManager.userActivity(curTime, false, PowerManager.USER_ACTIVITY_EVENT_OTHER);
}
synchronized (mLock) {
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index e63da05d8dfe..8604f95bb77c 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -1693,7 +1693,7 @@ String8 InputDispatcher::getApplicationWindowLabelLocked(
}
void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
- int32_t eventType = POWER_MANAGER_OTHER_EVENT;
+ int32_t eventType = USER_ACTIVITY_EVENT_OTHER;
switch (eventEntry->type) {
case EventEntry::TYPE_MOTION: {
const MotionEntry* motionEntry = static_cast<const MotionEntry*>(eventEntry);
@@ -1702,7 +1702,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
}
if (MotionEvent::isTouchEvent(motionEntry->source, motionEntry->action)) {
- eventType = POWER_MANAGER_TOUCH_EVENT;
+ eventType = USER_ACTIVITY_EVENT_TOUCH;
}
break;
}
@@ -1711,7 +1711,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
if (keyEntry->flags & AKEY_EVENT_FLAG_CANCELED) {
return;
}
- eventType = POWER_MANAGER_BUTTON_EVENT;
+ eventType = USER_ACTIVITY_EVENT_BUTTON;
break;
}
}
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java
index 77b3b5042cab..8836bac2e39d 100644
--- a/services/java/com/android/server/AppWidgetServiceImpl.java
+++ b/services/java/com/android/server/AppWidgetServiceImpl.java
@@ -36,6 +36,7 @@ import android.content.pm.ServiceInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
+import android.graphics.Point;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -49,6 +50,7 @@ import android.util.Pair;
import android.util.Slog;
import android.util.TypedValue;
import android.util.Xml;
+import android.view.Display;
import android.view.WindowManager;
import android.widget.RemoteViews;
@@ -188,11 +190,12 @@ class AppWidgetServiceImpl {
void computeMaximumWidgetBitmapMemory() {
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
- int height = wm.getDefaultDisplay().getRawHeight();
- int width = wm.getDefaultDisplay().getRawWidth();
+ Display display = wm.getDefaultDisplay();
+ Point size = new Point();
+ display.getRealSize(size);
// Cap memory usage at 1.5 times the size of the display
// 1.5 * 4 bytes/pixel * w * h ==> 6 * w * h
- mMaxWidgetBitmapMemory = 6 * width * height;
+ mMaxWidgetBitmapMemory = 6 * size.x * size.y;
}
public void systemReady(boolean safeMode) {
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 9f9390195f62..a550f34ce9a3 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -188,95 +188,81 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private static final boolean TO_DEFAULT_TABLE = true;
private static final boolean TO_SECONDARY_TABLE = false;
- // Share the event space with NetworkStateTracker (which can't see this
- // internal class but sends us events). If you change these, change
- // NetworkStateTracker.java too.
- private static final int MIN_NETWORK_STATE_TRACKER_EVENT = 1;
- private static final int MAX_NETWORK_STATE_TRACKER_EVENT = 100;
-
/**
* used internally as a delayed event to make us switch back to the
* default network
*/
- private static final int EVENT_RESTORE_DEFAULT_NETWORK =
- MAX_NETWORK_STATE_TRACKER_EVENT + 1;
+ private static final int EVENT_RESTORE_DEFAULT_NETWORK = 1;
/**
* used internally to change our mobile data enabled flag
*/
- private static final int EVENT_CHANGE_MOBILE_DATA_ENABLED =
- MAX_NETWORK_STATE_TRACKER_EVENT + 2;
+ private static final int EVENT_CHANGE_MOBILE_DATA_ENABLED = 2;
/**
* used internally to change our network preference setting
* arg1 = networkType to prefer
*/
- private static final int EVENT_SET_NETWORK_PREFERENCE =
- MAX_NETWORK_STATE_TRACKER_EVENT + 3;
+ private static final int EVENT_SET_NETWORK_PREFERENCE = 3;
/**
* used internally to synchronize inet condition reports
* arg1 = networkType
* arg2 = condition (0 bad, 100 good)
*/
- private static final int EVENT_INET_CONDITION_CHANGE =
- MAX_NETWORK_STATE_TRACKER_EVENT + 4;
+ private static final int EVENT_INET_CONDITION_CHANGE = 4;
/**
* used internally to mark the end of inet condition hold periods
* arg1 = networkType
*/
- private static final int EVENT_INET_CONDITION_HOLD_END =
- MAX_NETWORK_STATE_TRACKER_EVENT + 5;
+ private static final int EVENT_INET_CONDITION_HOLD_END = 5;
/**
* used internally to set enable/disable cellular data
* arg1 = ENBALED or DISABLED
*/
- private static final int EVENT_SET_MOBILE_DATA =
- MAX_NETWORK_STATE_TRACKER_EVENT + 7;
+ private static final int EVENT_SET_MOBILE_DATA = 7;
/**
* used internally to clear a wakelock when transitioning
* from one net to another
*/
- private static final int EVENT_CLEAR_NET_TRANSITION_WAKELOCK =
- MAX_NETWORK_STATE_TRACKER_EVENT + 8;
+ private static final int EVENT_CLEAR_NET_TRANSITION_WAKELOCK = 8;
/**
* used internally to reload global proxy settings
*/
- private static final int EVENT_APPLY_GLOBAL_HTTP_PROXY =
- MAX_NETWORK_STATE_TRACKER_EVENT + 9;
+ private static final int EVENT_APPLY_GLOBAL_HTTP_PROXY = 9;
/**
* used internally to set external dependency met/unmet
* arg1 = ENABLED (met) or DISABLED (unmet)
* arg2 = NetworkType
*/
- private static final int EVENT_SET_DEPENDENCY_MET =
- MAX_NETWORK_STATE_TRACKER_EVENT + 10;
+ private static final int EVENT_SET_DEPENDENCY_MET = 10;
/**
* used internally to restore DNS properties back to the
* default network
*/
- private static final int EVENT_RESTORE_DNS =
- MAX_NETWORK_STATE_TRACKER_EVENT + 11;
+ private static final int EVENT_RESTORE_DNS = 11;
/**
* used internally to send a sticky broadcast delayed.
*/
- private static final int EVENT_SEND_STICKY_BROADCAST_INTENT =
- MAX_NETWORK_STATE_TRACKER_EVENT + 12;
+ private static final int EVENT_SEND_STICKY_BROADCAST_INTENT = 12;
/**
* Used internally to
* {@link NetworkStateTracker#setPolicyDataEnable(boolean)}.
*/
- private static final int EVENT_SET_POLICY_DATA_ENABLE = MAX_NETWORK_STATE_TRACKER_EVENT + 13;
+ private static final int EVENT_SET_POLICY_DATA_ENABLE = 13;
- private Handler mHandler;
+ /** Handler used for internal events. */
+ private InternalHandler mHandler;
+ /** Handler used for incoming {@link NetworkStateTracker} events. */
+ private NetworkStateTrackerHandler mTrackerHandler;
// list of DeathRecipients used to make sure features are turned off when
// a process dies
@@ -334,7 +320,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
HandlerThread handlerThread = new HandlerThread("ConnectivityServiceThread");
handlerThread.start();
- mHandler = new MyHandler(handlerThread.getLooper());
+ mHandler = new InternalHandler(handlerThread.getLooper());
+ mTrackerHandler = new NetworkStateTrackerHandler(handlerThread.getLooper());
// setup our unique device name
if (TextUtils.isEmpty(SystemProperties.get("net.hostname"))) {
@@ -484,33 +471,33 @@ public class ConnectivityService extends IConnectivityManager.Stub {
for (int netType : mPriorityList) {
switch (mNetConfigs[netType].radio) {
case ConnectivityManager.TYPE_WIFI:
- mNetTrackers[netType] = new WifiStateTracker(netType,
- mNetConfigs[netType].name);
- mNetTrackers[netType].startMonitoring(context, mHandler);
- break;
+ mNetTrackers[netType] = new WifiStateTracker(
+ netType, mNetConfigs[netType].name);
+ mNetTrackers[netType].startMonitoring(context, mTrackerHandler);
+ break;
case ConnectivityManager.TYPE_MOBILE:
mNetTrackers[netType] = new MobileDataStateTracker(netType,
mNetConfigs[netType].name);
- mNetTrackers[netType].startMonitoring(context, mHandler);
+ mNetTrackers[netType].startMonitoring(context, mTrackerHandler);
break;
case ConnectivityManager.TYPE_DUMMY:
mNetTrackers[netType] = new DummyDataStateTracker(netType,
mNetConfigs[netType].name);
- mNetTrackers[netType].startMonitoring(context, mHandler);
+ mNetTrackers[netType].startMonitoring(context, mTrackerHandler);
break;
case ConnectivityManager.TYPE_BLUETOOTH:
mNetTrackers[netType] = BluetoothTetheringDataTracker.getInstance();
- mNetTrackers[netType].startMonitoring(context, mHandler);
+ mNetTrackers[netType].startMonitoring(context, mTrackerHandler);
break;
case ConnectivityManager.TYPE_WIMAX:
mNetTrackers[netType] = makeWimaxStateTracker();
if (mNetTrackers[netType]!= null) {
- mNetTrackers[netType].startMonitoring(context, mHandler);
+ mNetTrackers[netType].startMonitoring(context, mTrackerHandler);
}
break;
case ConnectivityManager.TYPE_ETHERNET:
mNetTrackers[netType] = EthernetDataTracker.getInstance();
- mNetTrackers[netType].startMonitoring(context, mHandler);
+ mNetTrackers[netType].startMonitoring(context, mTrackerHandler);
break;
default:
loge("Trying to create a DataStateTracker for an unknown radio type " +
@@ -557,8 +544,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
loadGlobalProxy();
}
-private NetworkStateTracker makeWimaxStateTracker() {
- //Initialize Wimax
+
+ private NetworkStateTracker makeWimaxStateTracker() {
+ // Initialize Wimax
DexClassLoader wimaxClassLoader;
Class wimaxStateTrackerClass = null;
Class wimaxServiceClass = null;
@@ -611,7 +599,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
Constructor wmxStTrkrConst = wimaxStateTrackerClass.getConstructor
(new Class[] {Context.class, Handler.class});
wimaxStateTracker = (NetworkStateTracker)wmxStTrkrConst.newInstance(mContext,
- mHandler);
+ mTrackerHandler);
Constructor wmxSrvConst = wimaxServiceClass.getDeclaredConstructor
(new Class[] {Context.class, wimaxStateTrackerClass});
@@ -632,6 +620,7 @@ private NetworkStateTracker makeWimaxStateTracker() {
return wimaxStateTracker;
}
+
/**
* Sets the preferred network.
* @param preference the new preference
@@ -639,7 +628,8 @@ private NetworkStateTracker makeWimaxStateTracker() {
public void setNetworkPreference(int preference) {
enforceChangePermission();
- mHandler.sendMessage(mHandler.obtainMessage(EVENT_SET_NETWORK_PREFERENCE, preference, 0));
+ mHandler.sendMessage(
+ mHandler.obtainMessage(EVENT_SET_NETWORK_PREFERENCE, preference, 0));
}
public int getNetworkPreference() {
@@ -2460,8 +2450,8 @@ private NetworkStateTracker makeWimaxStateTracker() {
}
// must be stateless - things change under us.
- private class MyHandler extends Handler {
- public MyHandler(Looper looper) {
+ private class NetworkStateTrackerHandler extends Handler {
+ public NetworkStateTrackerHandler(Looper looper) {
super(looper);
}
@@ -2519,6 +2509,19 @@ private NetworkStateTracker makeWimaxStateTracker() {
// @see bug/4455071
handleConnectivityChange(info.getType(), false);
break;
+ }
+ }
+ }
+
+ private class InternalHandler extends Handler {
+ public InternalHandler(Looper looper) {
+ super(looper);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ NetworkInfo info;
+ switch (msg.what) {
case EVENT_CLEAR_NET_TRANSITION_WAKELOCK:
String causedBy = null;
synchronized (ConnectivityService.this) {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 218545638550..d766afd09037 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -49,6 +49,7 @@ import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.widget.LockSettingsService;
import com.android.server.accessibility.AccessibilityManagerService;
import com.android.server.am.ActivityManagerService;
+import com.android.server.display.DisplayManagerService;
import com.android.server.input.InputManagerService;
import com.android.server.net.NetworkPolicyManagerService;
import com.android.server.net.NetworkStatsService;
@@ -115,6 +116,7 @@ class ServerThread extends Thread {
LightsService lights = null;
PowerManagerService power = null;
+ DisplayManagerService display = null;
BatteryService battery = null;
VibratorService vibrator = null;
AlarmManagerService alarm = null;
@@ -148,8 +150,13 @@ class ServerThread extends Thread {
power = new PowerManagerService();
ServiceManager.addService(Context.POWER_SERVICE, power);
+ Slog.i(TAG, "Display Manager");
+ display = new DisplayManagerService();
+ ServiceManager.addService(Context.DISPLAY_SERVICE, display);
+
Slog.i(TAG, "Activity Manager");
context = ActivityManagerService.main(factoryTest);
+ display.setContext(context);
Slog.i(TAG, "Telephony Registry");
ServiceManager.addService("telephony.registry", new TelephonyRegistry(context));
@@ -214,7 +221,7 @@ class ServerThread extends Thread {
// only initialize the power service after we have started the
// lights service, content providers and the battery service.
- power.init(context, lights, ActivityManagerService.self(), battery);
+ power.init(context, lights, ActivityManagerService.self(), battery, display);
Slog.i(TAG, "Alarm Manager");
alarm = new AlarmManagerService(context);
@@ -225,7 +232,7 @@ class ServerThread extends Thread {
ActivityManagerService.self());
Slog.i(TAG, "Window Manager");
- wm = WindowManagerService.main(context, power,
+ wm = WindowManagerService.main(context, power, display,
factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL,
!firstBoot, onlyCore);
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java
index c23a1d9c10ec..087e8db2deeb 100644
--- a/services/java/com/android/server/TelephonyRegistry.java
+++ b/services/java/com/android/server/TelephonyRegistry.java
@@ -35,6 +35,7 @@ import android.text.TextUtils;
import android.util.Slog;
import java.util.ArrayList;
+import java.util.List;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.net.NetworkInterface;
@@ -109,7 +110,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
private int mOtaspMode = ServiceStateTracker.OTASP_UNKNOWN;
- private CellInfo mCellInfo = null;
+ private List<CellInfo> mCellInfo = null;
static final int PHONE_STATE_PERMISSION_MASK =
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR |
@@ -242,7 +243,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
if ((events & PhoneStateListener.LISTEN_CELL_INFO) != 0) {
try {
- r.callback.onCellInfoChanged(new CellInfo(mCellInfo));
+ r.callback.onCellInfoChanged(mCellInfo);
} catch (RemoteException ex) {
remove(r.binder);
}
@@ -336,7 +337,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
broadcastSignalStrengthChanged(signalStrength);
}
- public void notifyCellInfo(CellInfo cellInfo) {
+ public void notifyCellInfo(List<CellInfo> cellInfo) {
if (!checkNotifyPermission("notifyCellInfo()")) {
return;
}
@@ -346,7 +347,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
for (Record r : mRecords) {
if ((r.events & PhoneStateListener.LISTEN_CELL_INFO) != 0) {
try {
- r.callback.onCellInfoChanged(new CellInfo(cellInfo));
+ r.callback.onCellInfoChanged(cellInfo);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 53fb60be026b..e1c05b517eb6 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -955,12 +955,10 @@ public class WifiService extends IWifiManager.Stub {
* an AsyncChannel communication with WifiService
*/
public Messenger getWifiServiceMessenger() {
- /* Enforce the highest permissions
- TODO: when we consider exposing the asynchronous API, think about
- how to provide both access and change permissions seperately
- */
- enforceAccessPermission();
- enforceChangePermission();
+ /* STOPSHIP: Fix this to have old sync API not need these new permissions
+ * enforceAccessPermission();
+ * enforceChangePermission();
+ */
return new Messenger(mAsyncServiceHandler);
}
diff --git a/services/java/com/android/server/display/DisplayAdapter.java b/services/java/com/android/server/display/DisplayAdapter.java
new file mode 100644
index 000000000000..e150bf8adf02
--- /dev/null
+++ b/services/java/com/android/server/display/DisplayAdapter.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 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.server.display;
+
+/**
+ * A display adapter makes one or more display devices available to the system.
+ * <p>
+ * For now, all display adapters are registered in the system server but
+ * in principle it could be done from other processes.
+ * </p>
+ */
+public abstract class DisplayAdapter {
+ /**
+ * Gets the display adapter name.
+ * @return The display adapter name.
+ */
+ public abstract String getName();
+
+ // TODO: dynamically register display devices
+ public abstract DisplayDevice[] getDisplayDevices();
+}
diff --git a/services/java/com/android/server/display/DisplayDevice.java b/services/java/com/android/server/display/DisplayDevice.java
new file mode 100644
index 000000000000..6d723f24b78e
--- /dev/null
+++ b/services/java/com/android/server/display/DisplayDevice.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 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.server.display;
+
+/**
+ * Represents a physical display device such as the built-in display
+ * or an external monitor.
+ */
+public abstract class DisplayDevice {
+ public abstract void getInfo(DisplayDeviceInfo outInfo);
+}
diff --git a/services/java/com/android/server/display/DisplayDeviceInfo.java b/services/java/com/android/server/display/DisplayDeviceInfo.java
new file mode 100644
index 000000000000..c28b9bbea7cb
--- /dev/null
+++ b/services/java/com/android/server/display/DisplayDeviceInfo.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 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.server.display;
+
+/**
+ * Describes the characteristics of a physical display device.
+ */
+public final class DisplayDeviceInfo {
+ /**
+ * The width of the display in its natural orientation, in pixels.
+ * This value is not affected by display rotation.
+ */
+ public int width;
+
+ /**
+ * The height of the display in its natural orientation, in pixels.
+ * This value is not affected by display rotation.
+ */
+ public int height;
+
+ public float refreshRate;
+ public float density;
+ public float xDpi;
+ public float yDpi;
+
+ public void copyFrom(DisplayDeviceInfo other) {
+ width = other.width;
+ height = other.height;
+ refreshRate = other.refreshRate;
+ density = other.density;
+ xDpi = other.xDpi;
+ yDpi = other.yDpi;
+ }
+
+ @Override
+ public String toString() {
+ return width + " x " + height + ", " + refreshRate + " fps, "
+ + "density " + density + ", " + xDpi + " x " + yDpi + " dpi";
+ }
+}
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
new file mode 100644
index 000000000000..082d28fec89c
--- /dev/null
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2012 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.server.display;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.hardware.display.IDisplayManager;
+import android.os.Binder;
+import android.os.SystemProperties;
+import android.view.Display;
+import android.view.DisplayInfo;
+import android.view.Surface;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+/**
+ * Manages the properties, media routing and power state of attached displays.
+ * <p>
+ * The display manager service does not own or directly control the displays.
+ * Instead, other components in the system register their display adapters with the
+ * display manager service which acts as a central controller.
+ * </p>
+ */
+public final class DisplayManagerService extends IDisplayManager.Stub {
+ private static final String TAG = "DisplayManagerService";
+
+ private static final String SYSTEM_HEADLESS = "ro.config.headless";
+
+ private final Object mLock = new Object();
+
+ private Context mContext;
+ private final boolean mHeadless;
+ private final ArrayList<DisplayAdapter> mDisplayAdapters = new ArrayList<DisplayAdapter>();
+
+ // TODO: represent this as a map between logical and physical devices
+ private DisplayInfo mDefaultDisplayInfo;
+ private DisplayDevice mDefaultDisplayDevice;
+ private DisplayDeviceInfo mDefaultDisplayDeviceInfo;
+
+ public DisplayManagerService() {
+ mHeadless = SystemProperties.get(SYSTEM_HEADLESS).equals("1");
+ registerDisplayAdapters();
+ initializeDefaultDisplay();
+ }
+
+ public void setContext(Context context) {
+ mContext = context;
+ }
+
+ // FIXME: this isn't the right API for the long term
+ public void setDefaultDisplayInfo(DisplayInfo info) {
+ synchronized (mLock) {
+ mDefaultDisplayInfo.copyFrom(info);
+ }
+ }
+
+ // FIXME: this isn't the right API for the long term
+ public void getDefaultExternalDisplayDeviceInfo(DisplayDeviceInfo info) {
+ // hardcoded assuming 720p touch screen plugged into HDMI and USB
+ // need to redesign this
+ info.width = 1280;
+ info.height = 720;
+ }
+
+ public boolean isHeadless() {
+ return mHeadless;
+ }
+
+ @Override // Binder call
+ public boolean getDisplayInfo(int displayId, DisplayInfo outInfo) {
+ synchronized (mLock) {
+ if (displayId == Display.DEFAULT_DISPLAY) {
+ outInfo.copyFrom(mDefaultDisplayInfo);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ @Override // Binder call
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ if (mContext == null
+ || mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP)
+ != PackageManager.PERMISSION_GRANTED) {
+ pw.println("Permission Denial: can't dump DisplayManager from from pid="
+ + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
+ return;
+ }
+
+ pw.println("DISPLAY MANAGER (dumpsys display)\n");
+
+ pw.println("Headless: " + mHeadless);
+
+ DisplayDeviceInfo info = new DisplayDeviceInfo();
+ for (DisplayAdapter adapter : mDisplayAdapters) {
+ pw.println("Displays for adapter " + adapter.getName());
+ for (DisplayDevice device : adapter.getDisplayDevices()) {
+ device.getInfo(info);
+ pw.print(" ");
+ pw.println(info);
+ }
+ }
+ }
+
+ private void registerDisplayAdapters() {
+ if (mHeadless) {
+ registerDisplayAdapter(new HeadlessDisplayAdapter());
+ } else {
+ registerDisplayAdapter(new SurfaceFlingerDisplayAdapter());
+ }
+ }
+
+ private void registerDisplayAdapter(DisplayAdapter adapter) {
+ // TODO: do this dynamically
+ mDisplayAdapters.add(adapter);
+ mDefaultDisplayDevice = adapter.getDisplayDevices()[0];
+ mDefaultDisplayDeviceInfo = new DisplayDeviceInfo();
+ mDefaultDisplayDevice.getInfo(mDefaultDisplayDeviceInfo);
+ }
+
+ private void initializeDefaultDisplay() {
+ // Bootstrap the default logical display using the default physical display.
+ mDefaultDisplayInfo = new DisplayInfo();
+ mDefaultDisplayInfo.appWidth = mDefaultDisplayDeviceInfo.width;
+ mDefaultDisplayInfo.appHeight = mDefaultDisplayDeviceInfo.height;
+ mDefaultDisplayInfo.logicalWidth = mDefaultDisplayDeviceInfo.width;
+ mDefaultDisplayInfo.logicalHeight = mDefaultDisplayDeviceInfo.height;
+ mDefaultDisplayInfo.rotation = Surface.ROTATION_0;
+ mDefaultDisplayInfo.refreshRate = mDefaultDisplayDeviceInfo.refreshRate;
+ mDefaultDisplayInfo.logicalDensity = mDefaultDisplayDeviceInfo.density;
+ mDefaultDisplayInfo.physicalXDpi = mDefaultDisplayDeviceInfo.xDpi;
+ mDefaultDisplayInfo.physicalYDpi = mDefaultDisplayDeviceInfo.yDpi;
+ mDefaultDisplayInfo.smallestNominalAppWidth = mDefaultDisplayDeviceInfo.width;
+ mDefaultDisplayInfo.smallestNominalAppHeight = mDefaultDisplayDeviceInfo.height;
+ mDefaultDisplayInfo.largestNominalAppWidth = mDefaultDisplayDeviceInfo.width;
+ mDefaultDisplayInfo.largestNominalAppHeight = mDefaultDisplayDeviceInfo.height;
+ }
+}
diff --git a/services/java/com/android/server/display/HeadlessDisplayAdapter.java b/services/java/com/android/server/display/HeadlessDisplayAdapter.java
new file mode 100644
index 000000000000..d2a70d2acf12
--- /dev/null
+++ b/services/java/com/android/server/display/HeadlessDisplayAdapter.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 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.server.display;
+
+/**
+ * Provides a fake default display for headless systems.
+ */
+public final class HeadlessDisplayAdapter extends DisplayAdapter {
+ private final DisplayDevice mDefaultDisplay = new DisplayDevice() {
+ @Override
+ public void getInfo(DisplayDeviceInfo outInfo) {
+ outInfo.width = 640;
+ outInfo.height = 480;
+ outInfo.refreshRate = 60;
+ outInfo.density = 1.0f;
+ outInfo.xDpi = 160;
+ outInfo.yDpi = 160;
+ }
+ };
+
+ @Override
+ public String getName() {
+ return "HeadlessDisplayAdapter";
+ }
+
+ @Override
+ public DisplayDevice[] getDisplayDevices() {
+ return new DisplayDevice[] { mDefaultDisplay };
+ }
+}
diff --git a/services/java/com/android/server/display/SurfaceFlingerDisplayAdapter.java b/services/java/com/android/server/display/SurfaceFlingerDisplayAdapter.java
new file mode 100644
index 000000000000..89934d3251b0
--- /dev/null
+++ b/services/java/com/android/server/display/SurfaceFlingerDisplayAdapter.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 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.server.display;
+
+/**
+ * A display adapter for the displays managed by Surface Flinger.
+ */
+public final class SurfaceFlingerDisplayAdapter extends DisplayAdapter {
+ private static native void nativeGetDefaultDisplayDeviceInfo(DisplayDeviceInfo outInfo);
+
+ private final DisplayDevice mDefaultDisplay = new DisplayDevice() {
+ @Override
+ public void getInfo(DisplayDeviceInfo outInfo) {
+ nativeGetDefaultDisplayDeviceInfo(outInfo);
+ }
+ };
+
+ @Override
+ public String getName() {
+ return "SurfaceFlingerDisplayAdapter";
+ }
+
+ @Override
+ public DisplayDevice[] getDisplayDevices() {
+ return new DisplayDevice[] { mDefaultDisplay };
+ }
+}
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index ba122ecdf231..373576bd8ddd 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -695,6 +695,14 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
mGlobalAlertBytes = mSettings.getGlobalAlertBytes(mPersistThreshold);
}
+ @Override
+ public void adjustNetworkStats(int uid, int tag, long rxBytes, long rxPackets, long txBytes,
+ long txPackets, long operationCount) {
+ mContext.enforceCallingOrSelfPermission(MODIFY_NETWORK_ACCOUNTING, TAG);
+
+ // TODO: store adjusted network stats in separate data structure
+ }
+
/**
* Receiver that watches for {@link IConnectivityManager} to claim network
* interfaces. Used to associate {@link TelephonyManager#getSubscriberId()}
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index 2940b70fb564..453c7a475b0a 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -22,6 +22,7 @@ import com.android.server.EventLogTags;
import com.android.server.LightsService;
import com.android.server.Watchdog;
import com.android.server.am.BatteryStatsService;
+import com.android.server.display.DisplayManagerService;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
@@ -254,6 +255,7 @@ public class PowerManagerService extends IPowerManager.Stub
private IActivityManager mActivityService;
private IBatteryStats mBatteryStats;
private BatteryService mBatteryService;
+ private DisplayManagerService mDisplayManagerService;
private SensorManager mSensorManager;
private Sensor mProximitySensor;
private Sensor mLightSensor;
@@ -543,12 +545,13 @@ public class PowerManagerService extends IPowerManager.Stub
private ContentQueryMap mSettings;
public void init(Context context, LightsService lights, IActivityManager activity,
- BatteryService battery) {
+ BatteryService battery, DisplayManagerService displayManagerService) {
mLightsService = lights;
mContext = context;
mActivityService = activity;
mBatteryStats = BatteryStatsService.getService();
mBatteryService = battery;
+ mDisplayManagerService = displayManagerService;
mLcdLight = lights.getLight(LightsService.LIGHT_ID_BACKLIGHT);
mButtonLight = lights.getLight(LightsService.LIGHT_ID_BUTTONS);
@@ -1034,7 +1037,7 @@ public class PowerManagerService extends IPowerManager.Stub
mWakeLockState = mLocks.gatherState();
// goes in the middle to reduce flicker
if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) {
- userActivity(SystemClock.uptimeMillis(), -1, false, OTHER_EVENT, false, true);
+ userActivity(SystemClock.uptimeMillis(), -1, false, PowerManager.USER_ACTIVITY_EVENT_OTHER, false, true);
}
setPowerState(mWakeLockState | mUserState);
}
@@ -2464,7 +2467,7 @@ public class PowerManagerService extends IPowerManager.Stub
public void userActivityWithForce(long time, boolean noChangeLights, boolean force) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
- userActivity(time, -1, noChangeLights, OTHER_EVENT, force, false);
+ userActivity(time, -1, noChangeLights, PowerManager.USER_ACTIVITY_EVENT_OTHER, force, false);
}
public void userActivity(long time, boolean noChangeLights) {
@@ -2477,7 +2480,7 @@ public class PowerManagerService extends IPowerManager.Stub
return;
}
- userActivity(time, -1, noChangeLights, OTHER_EVENT, false, false);
+ userActivity(time, -1, noChangeLights, PowerManager.USER_ACTIVITY_EVENT_OTHER, false, false);
}
public void userActivity(long time, boolean noChangeLights, int eventType) {
@@ -2495,13 +2498,13 @@ public class PowerManagerService extends IPowerManager.Stub
public void clearUserActivityTimeout(long now, long timeout) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
Slog.i(TAG, "clearUserActivity for " + timeout + "ms from now");
- userActivity(now, timeout, false, OTHER_EVENT, false, false);
+ userActivity(now, timeout, false, PowerManager.USER_ACTIVITY_EVENT_OTHER, false, false);
}
private void userActivity(long time, long timeoutOverride, boolean noChangeLights,
int eventType, boolean force, boolean ignoreIfScreenOff) {
- if (((mPokey & POKE_LOCK_IGNORE_TOUCH_EVENTS) != 0) && (eventType == TOUCH_EVENT)) {
+ if (((mPokey & POKE_LOCK_IGNORE_TOUCH_EVENTS) != 0) && (eventType == PowerManager.USER_ACTIVITY_EVENT_TOUCH)) {
if (false) {
Slog.d(TAG, "dropping touch mPokey=0x" + Integer.toHexString(mPokey));
}
@@ -2538,7 +2541,7 @@ public class PowerManagerService extends IPowerManager.Stub
if ((mUserActivityAllowed && !mProximitySensorActive) || force) {
// Only turn on button backlights if a button was pressed
// and auto brightness is disabled
- if (eventType == BUTTON_EVENT && !mUseSoftwareAutoBrightness) {
+ if (eventType == PowerManager.USER_ACTIVITY_EVENT_BUTTON && !mUseSoftwareAutoBrightness) {
mUserState = (mKeyboardVisible ? ALL_BRIGHT : SCREEN_BUTTON_BRIGHT);
} else {
// don't clear button/keyboard backlights when the screen is touched.
@@ -2866,7 +2869,7 @@ public class PowerManagerService extends IPowerManager.Stub
lightSensorChangedLocked(value, false);
}
}
- userActivity(SystemClock.uptimeMillis(), false, BUTTON_EVENT, true);
+ userActivity(SystemClock.uptimeMillis(), false, PowerManager.USER_ACTIVITY_EVENT_BUTTON, true);
}
}
}
@@ -3083,7 +3086,7 @@ public class PowerManagerService extends IPowerManager.Stub
Slog.d(TAG, "bootCompleted");
synchronized (mLocks) {
mBootCompleted = true;
- userActivity(SystemClock.uptimeMillis(), false, BUTTON_EVENT, true);
+ userActivity(SystemClock.uptimeMillis(), false, PowerManager.USER_ACTIVITY_EVENT_BUTTON, true);
updateWakeLockLocked();
mLocks.notifyAll();
}
diff --git a/services/java/com/android/server/wm/BlackFrame.java b/services/java/com/android/server/wm/BlackFrame.java
index 27af31328e55..b98ab004ff3b 100644
--- a/services/java/com/android/server/wm/BlackFrame.java
+++ b/services/java/com/android/server/wm/BlackFrame.java
@@ -22,6 +22,7 @@ import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.util.Slog;
+import android.view.Display;
import android.view.Surface;
import android.view.SurfaceSession;
@@ -44,11 +45,11 @@ public class BlackFrame {
int h = b-t;
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
surface = new WindowStateAnimator.SurfaceTrace(session, 0, "BlackSurface("
- + l + ", " + t + ")",
- -1, w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
+ + l + ", " + t + ")", Display.DEFAULT_DISPLAY,
+ w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
} else {
- surface = new Surface(session, 0, "BlackSurface",
- -1, w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
+ surface = new Surface(session, 0, "BlackSurface", Display.DEFAULT_DISPLAY,
+ w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
}
surface.setAlpha(1);
surface.setLayer(layer);
diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java
index e8f56c885996..7e8b0ecfbb72 100644
--- a/services/java/com/android/server/wm/DimAnimator.java
+++ b/services/java/com/android/server/wm/DimAnimator.java
@@ -39,18 +39,18 @@ class DimAnimator {
int mLastDimWidth, mLastDimHeight;
- DimAnimator (SurfaceSession session) {
+ DimAnimator (SurfaceSession session, final int displayId) {
if (mDimSurface == null) {
try {
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
"DimAnimator",
- -1, 16, 16, PixelFormat.OPAQUE,
+ displayId, 16, 16, PixelFormat.OPAQUE,
Surface.FX_SURFACE_DIM);
} else {
mDimSurface = new Surface(session, 0,
"DimAnimator",
- -1, 16, 16, PixelFormat.OPAQUE,
+ displayId, 16, 16, PixelFormat.OPAQUE,
Surface.FX_SURFACE_DIM);
}
if (WindowManagerService.SHOW_TRANSACTIONS ||
diff --git a/services/java/com/android/server/wm/DimSurface.java b/services/java/com/android/server/wm/DimSurface.java
index 9fca41836067..0e5d5563c910 100644
--- a/services/java/com/android/server/wm/DimSurface.java
+++ b/services/java/com/android/server/wm/DimSurface.java
@@ -30,18 +30,18 @@ class DimSurface {
int mLayer = -1;
int mLastDimWidth, mLastDimHeight;
- DimSurface(SurfaceSession session) {
+ DimSurface(SurfaceSession session, final int displayId) {
if (mDimSurface == null) {
try {
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
"DimSurface",
- -1, 16, 16, PixelFormat.OPAQUE,
+ displayId, 16, 16, PixelFormat.OPAQUE,
Surface.FX_SURFACE_DIM);
} else {
mDimSurface = new Surface(session, 0,
"DimSurface",
- -1, 16, 16, PixelFormat.OPAQUE,
+ displayId, 16, 16, PixelFormat.OPAQUE,
Surface.FX_SURFACE_DIM);
}
if (WindowManagerService.SHOW_TRANSACTIONS ||
diff --git a/services/java/com/android/server/wm/DragState.java b/services/java/com/android/server/wm/DragState.java
index b2cf3e0c39fc..f0b0e1f68ae8 100644
--- a/services/java/com/android/server/wm/DragState.java
+++ b/services/java/com/android/server/wm/DragState.java
@@ -125,8 +125,8 @@ class DragState {
// The drag window covers the entire display
mDragWindowHandle.frameLeft = 0;
mDragWindowHandle.frameTop = 0;
- mDragWindowHandle.frameRight = mService.mCurDisplayWidth;
- mDragWindowHandle.frameBottom = mService.mCurDisplayHeight;
+ mDragWindowHandle.frameRight = mService.mDisplayInfo.logicalWidth;
+ mDragWindowHandle.frameBottom = mService.mDisplayInfo.logicalHeight;
// Pause rotations before a drag.
if (WindowManagerService.DEBUG_ORIENTATION) {
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index 938db9e77fa7..142c60d68852 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -25,6 +25,7 @@ import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.util.Slog;
+import android.view.Display;
import android.view.Surface;
import android.view.SurfaceSession;
import android.view.animation.Animation;
@@ -212,10 +213,12 @@ class ScreenRotationAnimation {
try {
try {
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
- mSurface = new SurfaceTrace(session, 0, "FreezeSurface", -1, mWidth, mHeight,
+ mSurface = new SurfaceTrace(session, 0, "FreezeSurface", Display.DEFAULT_DISPLAY,
+ mWidth, mHeight,
PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
} else {
- mSurface = new Surface(session, 0, "FreezeSurface", -1, mWidth, mHeight,
+ mSurface = new Surface(session, 0, "FreezeSurface", Display.DEFAULT_DISPLAY,
+ mWidth, mHeight,
PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
}
if (!mSurface.isValid()) {
diff --git a/services/java/com/android/server/wm/Session.java b/services/java/com/android/server/wm/Session.java
index 34372faec255..d44b1701b54d 100644
--- a/services/java/com/android/server/wm/Session.java
+++ b/services/java/com/android/server/wm/Session.java
@@ -33,6 +33,7 @@ import android.os.Parcel;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Slog;
+import android.view.Display;
import android.view.IWindow;
import android.view.IWindowSession;
import android.view.InputChannel;
@@ -134,15 +135,33 @@ final class Session extends IWindowSession.Stub
}
}
+ @Override
public int add(IWindow window, int seq, WindowManager.LayoutParams attrs,
int viewVisibility, Rect outContentInsets, InputChannel outInputChannel) {
- return mService.addWindow(this, window, seq, attrs, viewVisibility, outContentInsets,
- outInputChannel);
+ return addToDisplay(window, seq, attrs, viewVisibility, Display.DEFAULT_DISPLAY,
+ outContentInsets, outInputChannel);
}
-
+
+ @Override
+ public int addToDisplay(IWindow window, int seq, WindowManager.LayoutParams attrs,
+ int viewVisibility, int displayId, Rect outContentInsets,
+ InputChannel outInputChannel) {
+ return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
+ outContentInsets, outInputChannel);
+ }
+
+ @Override
public int addWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs,
int viewVisibility, Rect outContentInsets) {
- return mService.addWindow(this, window, seq, attrs, viewVisibility, outContentInsets, null);
+ return addToDisplayWithoutInputChannel(window, seq, attrs, viewVisibility,
+ Display.DEFAULT_DISPLAY, outContentInsets);
+ }
+
+ @Override
+ public int addToDisplayWithoutInputChannel(IWindow window, int seq, WindowManager.LayoutParams attrs,
+ int viewVisibility, int displayId, Rect outContentInsets) {
+ return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId,
+ outContentInsets, null);
}
public void remove(IWindow window) {
diff --git a/services/java/com/android/server/wm/StrictModeFlash.java b/services/java/com/android/server/wm/StrictModeFlash.java
index 768d2db2cbd9..4b072c3319c6 100644
--- a/services/java/com/android/server/wm/StrictModeFlash.java
+++ b/services/java/com/android/server/wm/StrictModeFlash.java
@@ -39,7 +39,8 @@ class StrictModeFlash {
public StrictModeFlash(Display display, SurfaceSession session) {
try {
- mSurface = new Surface(session, 0, "StrictModeFlash", -1, 1, 1, PixelFormat.TRANSLUCENT, 0);
+ mSurface = new Surface(session, 0, "StrictModeFlash", Display.DEFAULT_DISPLAY,
+ 1, 1, PixelFormat.TRANSLUCENT, 0);
} catch (Surface.OutOfResourcesException e) {
return;
}
diff --git a/services/java/com/android/server/wm/Watermark.java b/services/java/com/android/server/wm/Watermark.java
index 5497eb41e2da..12076d834c11 100644
--- a/services/java/com/android/server/wm/Watermark.java
+++ b/services/java/com/android/server/wm/Watermark.java
@@ -112,7 +112,8 @@ class Watermark {
try {
mSurface = new Surface(session, 0,
- "WatermarkSurface", -1, 1, 1, PixelFormat.TRANSLUCENT, 0);
+ "WatermarkSurface", Display.DEFAULT_DISPLAY,
+ 1, 1, PixelFormat.TRANSLUCENT, 0);
mSurface.setLayer(WindowManagerService.TYPE_LAYER_MULTIPLIER*100);
mSurface.setPosition(0, 0);
mSurface.show();
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index 0b76fec257c8..b0c858c0d723 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -16,6 +16,7 @@ import android.content.Context;
import android.os.SystemClock;
import android.util.Log;
import android.util.Slog;
+import android.view.Display;
import android.view.Surface;
import android.view.WindowManagerPolicy;
import android.view.animation.Animation;
@@ -121,8 +122,9 @@ public class WindowAnimator {
}
};
- mWindowAnimationBackgroundSurface = new DimSurface(mService.mFxSession);
- mDimAnimator = new DimAnimator(mService.mFxSession);
+ mWindowAnimationBackgroundSurface =
+ new DimSurface(mService.mFxSession, Display.DEFAULT_DISPLAY);
+ mDimAnimator = new DimAnimator(mService.mFxSession, Display.DEFAULT_DISPLAY);
}
/** Locked on mAnimToLayout */
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index d0456ee403e9..d0aea12c3397 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -45,6 +45,8 @@ import com.android.server.AttributeCache;
import com.android.server.EventLogTags;
import com.android.server.Watchdog;
import com.android.server.am.BatteryStatsService;
+import com.android.server.display.DisplayDeviceInfo;
+import com.android.server.display.DisplayManagerService;
import com.android.server.input.InputManagerService;
import com.android.server.power.PowerManagerService;
import com.android.server.power.ShutdownThread;
@@ -78,7 +80,6 @@ import android.os.Debug;
import android.os.Handler;
import android.os.IBinder;
import android.os.IRemoteCallback;
-import android.os.LocalPowerManager;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
@@ -104,6 +105,7 @@ import android.util.SparseIntArray;
import android.util.TypedValue;
import android.view.Choreographer;
import android.view.Display;
+import android.view.DisplayInfo;
import android.view.Gravity;
import android.view.IApplicationToken;
import android.view.IInputFilter;
@@ -271,7 +273,6 @@ public class WindowManagerService extends IWindowManager.Stub
private static final String SYSTEM_SECURE = "ro.secure";
private static final String SYSTEM_DEBUGGABLE = "ro.debuggable";
- private static final String SYSTEM_HEADLESS = "ro.config.headless";
/**
* Condition waited on by {@link #reenableKeyguard} to know the call to
@@ -482,14 +483,7 @@ public class WindowManagerService extends IWindowManager.Stub
int mInitialDisplayHeight = 0;
int mBaseDisplayWidth = 0;
int mBaseDisplayHeight = 0;
- int mCurDisplayWidth = 0;
- int mCurDisplayHeight = 0;
- int mAppDisplayWidth = 0;
- int mAppDisplayHeight = 0;
- int mSmallestDisplayWidth = 0;
- int mSmallestDisplayHeight = 0;
- int mLargestDisplayWidth = 0;
- int mLargestDisplayHeight = 0;
+ final DisplayInfo mDisplayInfo = new DisplayInfo();
int mRotation = 0;
int mForcedAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@@ -616,6 +610,7 @@ public class WindowManagerService extends IWindowManager.Stub
float mAnimatorDurationScale = 1.0f;
final InputManagerService mInputManager;
+ final DisplayManagerService mDisplayManager;
// Who is holding the screen on.
Session mHoldingScreenOn;
@@ -785,9 +780,10 @@ public class WindowManagerService extends IWindowManager.Stub
final boolean mOnlyCore;
public static WindowManagerService main(Context context,
- PowerManagerService pm, boolean haveInputMethods, boolean allowBootMsgs,
+ PowerManagerService pm, DisplayManagerService dm,
+ boolean haveInputMethods, boolean allowBootMsgs,
boolean onlyCore) {
- WMThread thr = new WMThread(context, pm, haveInputMethods, allowBootMsgs, onlyCore);
+ WMThread thr = new WMThread(context, pm, dm, haveInputMethods, allowBootMsgs, onlyCore);
thr.start();
synchronized (thr) {
@@ -806,15 +802,18 @@ public class WindowManagerService extends IWindowManager.Stub
private final Context mContext;
private final PowerManagerService mPM;
+ private final DisplayManagerService mDisplayManager;
private final boolean mHaveInputMethods;
private final boolean mAllowBootMessages;
private final boolean mOnlyCore;
public WMThread(Context context, PowerManagerService pm,
+ DisplayManagerService dm,
boolean haveInputMethods, boolean allowBootMsgs, boolean onlyCore) {
super("WindowManager");
mContext = context;
mPM = pm;
+ mDisplayManager = dm;
mHaveInputMethods = haveInputMethods;
mAllowBootMessages = allowBootMsgs;
mOnlyCore = onlyCore;
@@ -825,7 +824,7 @@ public class WindowManagerService extends IWindowManager.Stub
Looper.prepare();
//Looper.myLooper().setMessageLogging(new LogPrinter(
// android.util.Log.DEBUG, TAG, android.util.Log.LOG_ID_SYSTEM));
- WindowManagerService s = new WindowManagerService(mContext, mPM,
+ WindowManagerService s = new WindowManagerService(mContext, mPM, mDisplayManager,
mHaveInputMethods, mAllowBootMessages, mOnlyCore);
android.os.Process.setThreadPriority(
android.os.Process.THREAD_PRIORITY_DISPLAY);
@@ -892,6 +891,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
private WindowManagerService(Context context, PowerManagerService pm,
+ DisplayManagerService displayManager,
boolean haveInputMethods, boolean showBootMsgs, boolean onlyCore) {
mContext = context;
mHaveInputMethods = haveInputMethods;
@@ -899,7 +899,8 @@ public class WindowManagerService extends IWindowManager.Stub
mOnlyCore = onlyCore;
mLimitedAlphaCompositing = context.getResources().getBoolean(
com.android.internal.R.bool.config_sf_limitedAlpha);
- mHeadless = "1".equals(SystemProperties.get(SYSTEM_HEADLESS, "0"));
+ mDisplayManager = displayManager;
+ mHeadless = displayManager.isHeadless();
mPowerManager = pm;
mPowerManager.setPolicy(mPolicy);
@@ -1650,8 +1651,8 @@ public class WindowManagerService extends IWindowManager.Stub
mInnerFields.mWallpaperMayChange = false;
int changed = 0;
- final int dw = mAppDisplayWidth;
- final int dh = mAppDisplayHeight;
+ final int dw = mDisplayInfo.appWidth;
+ final int dh = mDisplayInfo.appHeight;
// First find top-most window that has asked to be on top of the
// wallpaper; all wallpapers go behind it.
@@ -2060,8 +2061,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
void updateWallpaperOffsetLocked(WindowState changingTarget, boolean sync) {
- final int dw = mAppDisplayWidth;
- final int dh = mAppDisplayHeight;
+ final int dw = mDisplayInfo.appWidth;
+ final int dh = mDisplayInfo.appHeight;
WindowState target = mWallpaperTarget;
if (target != null) {
@@ -2123,8 +2124,8 @@ public class WindowManagerService extends IWindowManager.Stub
void updateWallpaperVisibilityLocked() {
final boolean visible = isWallpaperVisible(mWallpaperTarget);
- final int dw = mAppDisplayWidth;
- final int dh = mAppDisplayHeight;
+ final int dw = mDisplayInfo.appWidth;
+ final int dh = mDisplayInfo.appHeight;
int curTokenIndex = mWallpaperTokens.size();
while (curTokenIndex > 0) {
@@ -2151,7 +2152,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
public int addWindow(Session session, IWindow client, int seq,
- WindowManager.LayoutParams attrs, int viewVisibility,
+ WindowManager.LayoutParams attrs, int viewVisibility, int displayId,
Rect outContentInsets, InputChannel outInputChannel) {
int res = mPolicy.checkAddPermission(attrs);
if (res != WindowManagerImpl.ADD_OKAY) {
@@ -2253,7 +2254,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
win = new WindowState(this, session, client, token,
- attachedWindow, seq, attrs, viewVisibility);
+ attachedWindow, seq, attrs, viewVisibility, displayId);
if (win.mDeathRecipient == null) {
// Client has apparently died, so there is no reason to
// continue.
@@ -2699,9 +2700,11 @@ public class WindowManagerService extends IWindowManager.Stub
mTmpFloats[Matrix.MSKEW_X] = dsdy;
mTmpFloats[Matrix.MSCALE_Y] = dtdy;
matrix.setValues(mTmpFloats);
- final RectF dispRect = new RectF(0, 0, mCurDisplayWidth, mCurDisplayHeight);
+ final RectF dispRect = new RectF(0, 0,
+ mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
matrix.mapRect(dispRect);
- window.mGivenTouchableRegion.set(0, 0, mCurDisplayWidth, mCurDisplayHeight);
+ window.mGivenTouchableRegion.set(0, 0,
+ mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
window.mGivenTouchableRegion.op((int)dispRect.left, (int)dispRect.top,
(int)dispRect.right, (int)dispRect.bottom, Region.Op.DIFFERENCE);
window.mTouchableInsets = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
@@ -2981,7 +2984,8 @@ public class WindowManagerService extends IWindowManager.Stub
configChanged = updateOrientationFromAppTokensLocked(false);
performLayoutAndPlaceSurfacesLocked();
if (toBeDisplayed && win.mIsWallpaper) {
- updateWallpaperOffsetLocked(win, mAppDisplayWidth, mAppDisplayHeight, false);
+ updateWallpaperOffsetLocked(win,
+ mDisplayInfo.appWidth, mDisplayInfo.appHeight, false);
}
if (win.mAppToken != null) {
win.mAppToken.updateReportedVisibilityLocked();
@@ -3201,8 +3205,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (enter) {
// Entering app zooms out from the center of the initial rect.
- float scaleW = mNextAppTransitionStartWidth / (float) mAppDisplayWidth;
- float scaleH = mNextAppTransitionStartHeight / (float) mAppDisplayHeight;
+ float scaleW = mNextAppTransitionStartWidth / (float) mDisplayInfo.appWidth;
+ float scaleH = mNextAppTransitionStartHeight / (float) mDisplayInfo.appHeight;
Animation scale = new ScaleAnimation(scaleW, 1, scaleH, 1,
computePivot(mNextAppTransitionStartX, scaleW),
computePivot(mNextAppTransitionStartY, scaleH));
@@ -3222,8 +3226,8 @@ public class WindowManagerService extends IWindowManager.Stub
final Interpolator interpolator = AnimationUtils.loadInterpolator(mContext,
com.android.internal.R.interpolator.decelerate_cubic);
a.setInterpolator(interpolator);
- a.initialize(mAppDisplayWidth, mAppDisplayHeight,
- mAppDisplayWidth, mAppDisplayHeight);
+ a.initialize(mDisplayInfo.appWidth, mDisplayInfo.appHeight,
+ mDisplayInfo.appWidth, mDisplayInfo.appHeight);
return a;
}
@@ -3252,8 +3256,8 @@ public class WindowManagerService extends IWindowManager.Stub
if (thumb) {
// Animation for zooming thumbnail from its initial size to
// filling the screen.
- float scaleW = mAppDisplayWidth/thumbWidth;
- float scaleH = mAppDisplayHeight/thumbHeight;
+ float scaleW = mDisplayInfo.appWidth/thumbWidth;
+ float scaleH = mDisplayInfo.appHeight/thumbHeight;
Animation scale = new ScaleAnimation(1, scaleW, 1, scaleH,
computePivot(mNextAppTransitionStartX, 1/scaleW),
@@ -3273,8 +3277,8 @@ public class WindowManagerService extends IWindowManager.Stub
a = set;
} else if (enter) {
// Entering app zooms out from the center of the thumbnail.
- float scaleW = thumbWidth / mAppDisplayWidth;
- float scaleH = thumbHeight / mAppDisplayHeight;
+ float scaleW = thumbWidth / mDisplayInfo.appWidth;
+ float scaleH = thumbHeight / mDisplayInfo.appHeight;
Animation scale = new ScaleAnimation(scaleW, 1, scaleH, 1,
computePivot(mNextAppTransitionStartX, scaleW),
computePivot(mNextAppTransitionStartY, scaleH));
@@ -3300,8 +3304,8 @@ public class WindowManagerService extends IWindowManager.Stub
final Interpolator interpolator = AnimationUtils.loadInterpolator(mContext,
com.android.internal.R.interpolator.decelerate_quad);
a.setInterpolator(interpolator);
- a.initialize(mAppDisplayWidth, mAppDisplayHeight,
- mAppDisplayWidth, mAppDisplayHeight);
+ a.initialize(mDisplayInfo.appWidth, mDisplayInfo.appHeight,
+ mDisplayInfo.appWidth, mDisplayInfo.appHeight);
return a;
}
@@ -5498,8 +5502,8 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized(mWindowMap) {
long ident = Binder.clearCallingIdentity();
- dw = mCurDisplayWidth;
- dh = mCurDisplayHeight;
+ dw = mDisplayInfo.logicalWidth;
+ dh = mDisplayInfo.logicalHeight;
int aboveAppLayer = mPolicy.windowTypeToLayerLw(
WindowManager.LayoutParams.TYPE_APPLICATION) * TYPE_LAYER_MULTIPLIER
@@ -5793,8 +5797,7 @@ public class WindowManagerService extends IWindowManager.Stub
mWaitingForConfig = true;
mLayoutNeeded = true;
startFreezingDisplayLocked(inTransaction);
- mInputManager.setDisplayOrientation(0, rotation,
- mDisplay != null ? mDisplay.getExternalRotation() : Surface.ROTATION_0);
+ mInputManager.setDisplayOrientation(0, rotation, Surface.ROTATION_0);
// We need to update our screen size information to match the new
// rotation. Note that this is redundant with the later call to
@@ -5816,7 +5819,7 @@ public class WindowManagerService extends IWindowManager.Stub
&& mAnimator.mScreenRotationAnimation.hasScreenshot()) {
if (mAnimator.mScreenRotationAnimation.setRotation(rotation, mFxSession,
MAX_ANIMATION_DURATION, mTransitionAnimationScale,
- mCurDisplayWidth, mCurDisplayHeight)) {
+ mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight)) {
updateLayoutToAnimationLocked();
}
}
@@ -6315,18 +6318,18 @@ public class WindowManagerService extends IWindowManager.Stub
private void adjustDisplaySizeRanges(int rotation, int dw, int dh) {
final int width = mPolicy.getConfigDisplayWidth(dw, dh, rotation);
- if (width < mSmallestDisplayWidth) {
- mSmallestDisplayWidth = width;
+ if (width < mDisplayInfo.smallestNominalAppWidth) {
+ mDisplayInfo.smallestNominalAppWidth = width;
}
- if (width > mLargestDisplayWidth) {
- mLargestDisplayWidth = width;
+ if (width > mDisplayInfo.largestNominalAppWidth) {
+ mDisplayInfo.largestNominalAppWidth = width;
}
final int height = mPolicy.getConfigDisplayHeight(dw, dh, rotation);
- if (height < mSmallestDisplayHeight) {
- mSmallestDisplayHeight = height;
+ if (height < mDisplayInfo.smallestNominalAppHeight) {
+ mDisplayInfo.smallestNominalAppHeight = height;
}
- if (height > mLargestDisplayHeight) {
- mLargestDisplayHeight = height;
+ if (height > mDisplayInfo.largestNominalAppHeight) {
+ mDisplayInfo.largestNominalAppHeight = height;
}
}
@@ -6423,10 +6426,10 @@ public class WindowManagerService extends IWindowManager.Stub
unrotDw = dw;
unrotDh = dh;
}
- mSmallestDisplayWidth = 1<<30;
- mSmallestDisplayHeight = 1<<30;
- mLargestDisplayWidth = 0;
- mLargestDisplayHeight = 0;
+ mDisplayInfo.smallestNominalAppWidth = 1<<30;
+ mDisplayInfo.smallestNominalAppHeight = 1<<30;
+ mDisplayInfo.largestNominalAppWidth = 0;
+ mDisplayInfo.largestNominalAppHeight = 0;
adjustDisplaySizeRanges(Surface.ROTATION_0, unrotDw, unrotDh);
adjustDisplaySizeRanges(Surface.ROTATION_90, unrotDh, unrotDw);
adjustDisplaySizeRanges(Surface.ROTATION_180, unrotDw, unrotDh);
@@ -6437,7 +6440,7 @@ public class WindowManagerService extends IWindowManager.Stub
sl = reduceConfigLayout(sl, Surface.ROTATION_90, density, unrotDh, unrotDw);
sl = reduceConfigLayout(sl, Surface.ROTATION_180, density, unrotDw, unrotDh);
sl = reduceConfigLayout(sl, Surface.ROTATION_270, density, unrotDh, unrotDw);
- outConfig.smallestScreenWidthDp = (int)(mSmallestDisplayWidth / density);
+ outConfig.smallestScreenWidthDp = (int)(mDisplayInfo.smallestNominalAppWidth / density);
outConfig.screenLayout = sl;
}
@@ -6481,33 +6484,25 @@ public class WindowManagerService extends IWindowManager.Stub
|| mRotation == Surface.ROTATION_270);
final int realdw = rotated ? mBaseDisplayHeight : mBaseDisplayWidth;
final int realdh = rotated ? mBaseDisplayWidth : mBaseDisplayHeight;
+ int dw = realdw;
+ int dh = realdh;
- synchronized(mDisplaySizeLock) {
- if (mAltOrientation) {
- mCurDisplayWidth = realdw;
- mCurDisplayHeight = realdh;
- if (realdw > realdh) {
- // Turn landscape into portrait.
- int maxw = (int)(realdh/1.3f);
- if (maxw < realdw) {
- mCurDisplayWidth = maxw;
- }
- } else {
- // Turn portrait into landscape.
- int maxh = (int)(realdw/1.3f);
- if (maxh < realdh) {
- mCurDisplayHeight = maxh;
- }
+ if (mAltOrientation) {
+ if (realdw > realdh) {
+ // Turn landscape into portrait.
+ int maxw = (int)(realdh/1.3f);
+ if (maxw < realdw) {
+ dw = maxw;
}
} else {
- mCurDisplayWidth = realdw;
- mCurDisplayHeight = realdh;
+ // Turn portrait into landscape.
+ int maxh = (int)(realdw/1.3f);
+ if (maxh < realdh) {
+ dh = maxh;
+ }
}
}
- final int dw = mCurDisplayWidth;
- final int dh = mCurDisplayHeight;
-
if (config != null) {
int orientation = Configuration.ORIENTATION_SQUARE;
if (dw < dh) {
@@ -6518,25 +6513,26 @@ public class WindowManagerService extends IWindowManager.Stub
config.orientation = orientation;
}
- // Update real display metrics.
- mDisplay.getMetricsWithSize(mRealDisplayMetrics, mCurDisplayWidth, mCurDisplayHeight);
-
// Update application display metrics.
- final DisplayMetrics dm = mDisplayMetrics;
final int appWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation);
final int appHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation);
synchronized(mDisplaySizeLock) {
- mAppDisplayWidth = appWidth;
- mAppDisplayHeight = appHeight;
- mAnimator.setDisplayDimensions(mCurDisplayWidth, mCurDisplayHeight,
- mAppDisplayWidth, mAppDisplayHeight);
+ mDisplayInfo.rotation = mRotation;
+ mDisplayInfo.logicalWidth = dw;
+ mDisplayInfo.logicalHeight = dh;
+ mDisplayInfo.appWidth = appWidth;
+ mDisplayInfo.appHeight = appHeight;
+ mDisplayInfo.getLogicalMetrics(mRealDisplayMetrics, null);
+ mDisplayInfo.getAppMetrics(mDisplayMetrics, null);
+ mDisplayManager.setDefaultDisplayInfo(mDisplayInfo);
+
+ mAnimator.setDisplayDimensions(dw, dh, appWidth, appHeight);
}
if (false) {
- Slog.i(TAG, "Set app display size: " + mAppDisplayWidth
- + " x " + mAppDisplayHeight);
+ Slog.i(TAG, "Set app display size: " + appWidth + " x " + appHeight);
}
- mDisplay.getMetricsWithSize(dm, mAppDisplayWidth, mAppDisplayHeight);
+ final DisplayMetrics dm = mDisplayMetrics;
mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm,
mCompatDisplayMetrics);
@@ -6677,7 +6673,8 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized (mWindowMap) {
try {
if (mDragState == null) {
- Surface surface = new Surface(session, callerPid, "drag surface", 0,
+ Surface surface = new Surface(session, callerPid, "drag surface",
+ Display.DEFAULT_DISPLAY,
width, height, PixelFormat.TRANSLUCENT, Surface.HIDDEN);
if (SHOW_TRANSACTIONS) Slog.i(TAG, " DRAG "
+ surface + ": CREATE");
@@ -6843,27 +6840,26 @@ public class WindowManagerService extends IWindowManager.Stub
mDisplay = wm.getDefaultDisplay();
mIsTouchDevice = mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_TOUCHSCREEN);
+
synchronized(mDisplaySizeLock) {
- mInitialDisplayWidth = mDisplay.getRawWidth();
- mInitialDisplayHeight = mDisplay.getRawHeight();
- int rot = mDisplay.getRotation();
- if (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270) {
- // If the screen is currently rotated, we need to swap the
- // initial width and height to get the true natural values.
- int tmp = mInitialDisplayWidth;
- mInitialDisplayWidth = mInitialDisplayHeight;
- mInitialDisplayHeight = tmp;
- }
- mBaseDisplayWidth = mCurDisplayWidth = mAppDisplayWidth = mInitialDisplayWidth;
- mBaseDisplayHeight = mCurDisplayHeight = mAppDisplayHeight = mInitialDisplayHeight;
- mAnimator.setDisplayDimensions(mCurDisplayWidth, mCurDisplayHeight,
- mAppDisplayWidth, mAppDisplayHeight);
+ // Bootstrap the default logical display from the display manager.
+ mDisplayManager.getDisplayInfo(Display.DEFAULT_DISPLAY, mDisplayInfo);
+ mInitialDisplayWidth = mDisplayInfo.logicalWidth;
+ mInitialDisplayHeight = mDisplayInfo.logicalHeight;
+ mBaseDisplayWidth = mInitialDisplayWidth;
+ mBaseDisplayHeight = mInitialDisplayHeight;
+
+ mAnimator.setDisplayDimensions(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight,
+ mDisplayInfo.appWidth, mDisplayInfo.appHeight);
}
+
+ DisplayDeviceInfo info = new DisplayDeviceInfo();
+ mDisplayManager.getDefaultExternalDisplayDeviceInfo(info);
mInputManager.setDisplaySize(Display.DEFAULT_DISPLAY,
- mDisplay.getRawWidth(), mDisplay.getRawHeight(),
- mDisplay.getRawExternalWidth(), mDisplay.getRawExternalHeight());
+ mInitialDisplayWidth, mInitialDisplayHeight,
+ info.width, info.height);
mInputManager.setDisplayOrientation(Display.DEFAULT_DISPLAY,
- mDisplay.getRotation(), mDisplay.getExternalRotation());
+ mDisplay.getRotation(), Surface.ROTATION_0);
mPolicy.setInitialDisplaySize(mDisplay, mInitialDisplayWidth, mInitialDisplayHeight);
}
@@ -7471,20 +7467,6 @@ public class WindowManagerService extends IWindowManager.Stub
return false;
}
- public void getDisplaySize(Point size) {
- synchronized(mDisplaySizeLock) {
- size.x = mAppDisplayWidth;
- size.y = mAppDisplayHeight;
- }
- }
-
- public void getRealDisplaySize(Point size) {
- synchronized(mDisplaySizeLock) {
- size.x = mCurDisplayWidth;
- size.y = mCurDisplayHeight;
- }
- }
-
public void getInitialDisplaySize(Point size) {
synchronized(mDisplaySizeLock) {
size.x = mInitialDisplayWidth;
@@ -7492,23 +7474,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
- public int getMaximumSizeDimension() {
- synchronized(mDisplaySizeLock) {
- // Do this based on the raw screen size, until we are smarter.
- return mBaseDisplayWidth > mBaseDisplayHeight
- ? mBaseDisplayWidth : mBaseDisplayHeight;
- }
- }
-
- public void getCurrentSizeRange(Point smallestSize, Point largestSize) {
- synchronized(mDisplaySizeLock) {
- smallestSize.x = mSmallestDisplayWidth;
- smallestSize.y = mSmallestDisplayHeight;
- largestSize.x = mLargestDisplayWidth;
- largestSize.y = mLargestDisplayHeight;
- }
- }
-
public void setForcedDisplaySize(int longDimen, int shortDimen) {
synchronized(mWindowMap) {
int width, height;
@@ -7899,8 +7864,8 @@ public class WindowManagerService extends IWindowManager.Stub
mLayoutNeeded = false;
- final int dw = mCurDisplayWidth;
- final int dh = mCurDisplayHeight;
+ final int dw = mDisplayInfo.logicalWidth;
+ final int dh = mDisplayInfo.logicalHeight;
final int NFW = mFakeWindows.size();
for (int i=0; i<NFW; i++) {
@@ -8265,7 +8230,8 @@ public class WindowManagerService extends IWindowManager.Stub
mNextAppTransitionThumbnail.getHeight());
try {
Surface surface = new Surface(mFxSession, Process.myPid(),
- "thumbnail anim", 0, dirty.width(), dirty.height(),
+ "thumbnail anim", Display.DEFAULT_DISPLAY,
+ dirty.width(), dirty.height(),
PixelFormat.TRANSLUCENT, Surface.HIDDEN);
topOpeningApp.mAppAnimator.thumbnail = surface;
if (SHOW_TRANSACTIONS) Slog.i(TAG, " THUMBNAIL "
@@ -8492,8 +8458,8 @@ public class WindowManagerService extends IWindowManager.Stub
if (!mAnimator.isDimming(winAnimator)) {
final int width, height;
if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
- width = mCurDisplayWidth;
- height = mCurDisplayHeight;
+ width = mDisplayInfo.logicalWidth;
+ height = mDisplayInfo.logicalHeight;
} else {
width = innerDw;
height = innerDh;
@@ -8537,10 +8503,10 @@ public class WindowManagerService extends IWindowManager.Stub
}
final long currentTime = SystemClock.uptimeMillis();
- final int dw = mCurDisplayWidth;
- final int dh = mCurDisplayHeight;
- final int innerDw = mAppDisplayWidth;
- final int innerDh = mAppDisplayHeight;
+ final int dw = mDisplayInfo.logicalWidth;
+ final int dh = mDisplayInfo.logicalHeight;
+ final int innerDw = mDisplayInfo.appWidth;
+ final int innerDh = mDisplayInfo.appHeight;
int i;
@@ -8985,7 +8951,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (mTurnOnScreen) {
if (DEBUG_VISIBILITY) Slog.v(TAG, "Turning screen on after layout!");
mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
- LocalPowerManager.BUTTON_EVENT, true);
+ PowerManager.USER_ACTIVITY_EVENT_BUTTON, true);
mTurnOnScreen = false;
}
@@ -9456,7 +9422,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
mAnimator.mScreenRotationAnimation = new ScreenRotationAnimation(mContext,
- mFxSession, inTransaction, mCurDisplayWidth, mCurDisplayHeight,
+ mFxSession, inTransaction, mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight,
mDisplay.getRotation());
}
}
@@ -9486,7 +9452,7 @@ public class WindowManagerService extends IWindowManager.Stub
&& mAnimator.mScreenRotationAnimation.hasScreenshot()) {
if (DEBUG_ORIENTATION) Slog.i(TAG, "**** Dismissing screen rotation animation");
if (mAnimator.mScreenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION,
- mTransitionAnimationScale, mCurDisplayWidth, mCurDisplayHeight)) {
+ mTransitionAnimationScale, mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight)) {
updateLayoutToAnimationLocked();
} else {
mAnimator.mScreenRotationAnimation.kill();
@@ -9935,19 +9901,21 @@ public class WindowManagerService extends IWindowManager.Stub
pw.print(" base=");
pw.print(mBaseDisplayWidth); pw.print("x"); pw.print(mBaseDisplayHeight);
}
- final int rawWidth = mDisplay.getRawWidth();
- final int rawHeight = mDisplay.getRawHeight();
- if (rawWidth != mCurDisplayWidth || rawHeight != mCurDisplayHeight) {
- pw.print(" raw="); pw.print(rawWidth); pw.print("x"); pw.print(rawHeight);
+ if (mInitialDisplayWidth != mDisplayInfo.logicalWidth
+ || mInitialDisplayHeight != mDisplayInfo.logicalHeight) {
+ pw.print(" init="); pw.print(mInitialDisplayWidth);
+ pw.print("x"); pw.print(mInitialDisplayHeight);
}
pw.print(" cur=");
- pw.print(mCurDisplayWidth); pw.print("x"); pw.print(mCurDisplayHeight);
+ pw.print(mDisplayInfo.logicalWidth);
+ pw.print("x"); pw.print(mDisplayInfo.logicalHeight);
pw.print(" app=");
- pw.print(mAppDisplayWidth); pw.print("x"); pw.print(mAppDisplayHeight);
- pw.print(" rng="); pw.print(mSmallestDisplayWidth);
- pw.print("x"); pw.print(mSmallestDisplayHeight);
- pw.print("-"); pw.print(mLargestDisplayWidth);
- pw.print("x"); pw.println(mLargestDisplayHeight);
+ pw.print(mDisplayInfo.appWidth);
+ pw.print("x"); pw.print(mDisplayInfo.appHeight);
+ pw.print(" rng="); pw.print(mDisplayInfo.smallestNominalAppWidth);
+ pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight);
+ pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
+ pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
} else {
pw.println(" NO DISPLAY");
}
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 94fd19944f1d..aff519e0e44f 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -251,15 +251,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
boolean mHasSurface = false;
+ int mDisplayId;
+
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
- int viewVisibility) {
+ int viewVisibility, int displayId) {
mService = service;
mSession = s;
mClient = c;
mToken = token;
mAttrs.copyFrom(a);
mViewVisibility = viewVisibility;
+ mDisplayId = displayId;
mPolicy = mService.mPolicy;
mContext = mService.mContext;
DeathRecipient deathRecipient = new DeathRecipient();
@@ -480,7 +483,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
if (mIsWallpaper && (fw != frame.width() || fh != frame.height())) {
mService.updateWallpaperOffsetLocked(this,
- mService.mAppDisplayWidth, mService.mAppDisplayHeight, false);
+ mService.mDisplayInfo.appWidth, mService.mDisplayInfo.appHeight, false);
}
if (WindowManagerService.localLOGV) {
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index f08204fe5065..2af4eee0998d 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -151,8 +151,8 @@ class WindowStateAnimator {
mAnimator = service.mAnimator;
mPolicy = service.mPolicy;
mContext = service.mContext;
- mAnimDw = service.mAppDisplayWidth;
- mAnimDh = service.mAppDisplayHeight;
+ mAnimDw = service.mDisplayInfo.appWidth;
+ mAnimDh = service.mDisplayInfo.appHeight;
mWin = win;
mAttachedWinAnimator = win.mAttachedWindow == null
@@ -248,8 +248,8 @@ class WindowStateAnimator {
" scale=" + mService.mWindowAnimationScale);
mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(),
mAnimDw, mAnimDh);
- mAnimDw = mService.mAppDisplayWidth;
- mAnimDh = mService.mAppDisplayHeight;
+ mAnimDw = mService.mDisplayInfo.appWidth;
+ mAnimDh = mService.mDisplayInfo.appHeight;
mAnimation.setStartTime(currentTime);
mLocalAnimating = true;
mAnimating = true;
@@ -471,18 +471,18 @@ class WindowStateAnimator {
private String mName = "Not named";
public SurfaceTrace(SurfaceSession s,
- int pid, int display, int w, int h, int format, int flags) throws
+ int pid, int displayId, int w, int h, int format, int flags) throws
OutOfResourcesException {
- super(s, pid, display, w, h, format, flags);
+ super(s, pid, displayId, w, h, format, flags);
mSize.set(w, h);
Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
+ Debug.getCallers(3));
}
public SurfaceTrace(SurfaceSession s,
- int pid, String name, int display, int w, int h, int format, int flags)
+ int pid, String name, int displayId, int w, int h, int format, int flags)
throws OutOfResourcesException {
- super(s, pid, name, display, w, h, format, flags);
+ super(s, pid, name, displayId, w, h, format, flags);
mName = name;
mSize.set(w, h);
Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
@@ -646,12 +646,12 @@ class WindowStateAnimator {
mSurface = new SurfaceTrace(
mSession.mSurfaceSession, mSession.mPid,
attrs.getTitle().toString(),
- 0, w, h, format, flags);
+ mWin.mDisplayId, w, h, format, flags);
} else {
mSurface = new Surface(
mSession.mSurfaceSession, mSession.mPid,
attrs.getTitle().toString(),
- 0, w, h, format, flags);
+ mWin.mDisplayId, w, h, format, flags);
}
mWin.mHasSurface = true;
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG,
@@ -1102,7 +1102,7 @@ class WindowStateAnimator {
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
if ((w.mAttrs.flags & LayoutParams.FLAG_DIM_BEHIND) != 0) {
mService.startDimming(this, w.mExiting ? 0 : w.mAttrs.dimAmount,
- mService.mAppDisplayWidth, mService.mAppDisplayHeight);
+ mService.mDisplayInfo.appWidth, mService.mDisplayInfo.appHeight);
}
} catch (RuntimeException e) {
// If something goes wrong with the surface (such
diff --git a/services/jni/Android.mk b/services/jni/Android.mk
index d097a9338a76..43e59b2f7735 100644
--- a/services/jni/Android.mk
+++ b/services/jni/Android.mk
@@ -4,6 +4,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
com_android_server_AlarmManagerService.cpp \
com_android_server_BatteryService.cpp \
+ com_android_server_display_SurfaceFlingerDisplayAdapter.cpp \
com_android_server_input_InputApplicationHandle.cpp \
com_android_server_input_InputManagerService.cpp \
com_android_server_input_InputWindowHandle.cpp \
diff --git a/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp b/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp
new file mode 100644
index 000000000000..e636eed8072a
--- /dev/null
+++ b/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#define LOG_TAG "SurfaceFlingerDisplayAdapter"
+
+#include "JNIHelp.h"
+#include "jni.h"
+#include <android_runtime/AndroidRuntime.h>
+
+#include <gui/SurfaceComposerClient.h>
+#include <ui/DisplayInfo.h>
+
+#include <utils/Log.h>
+
+namespace android {
+
+static struct {
+ jfieldID width;
+ jfieldID height;
+ jfieldID refreshRate;
+ jfieldID density;
+ jfieldID xDpi;
+ jfieldID yDpi;
+} gDisplayDeviceInfoClassInfo;
+
+
+static void nativeGetDefaultDisplayDeviceInfo(JNIEnv* env, jclass clazz, jobject infoObj) {
+ DisplayInfo info;
+ status_t err = SurfaceComposerClient::getDisplayInfo(0, &info);
+ if (err < 0) {
+ jniThrowExceptionFmt(env, "java/lang/RuntimeException",
+ "Could not get display info. err=%d", err);
+ return;
+ }
+
+ env->SetIntField(infoObj, gDisplayDeviceInfoClassInfo.width, info.w);
+ env->SetIntField(infoObj, gDisplayDeviceInfoClassInfo.height, info.h);
+ env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.refreshRate, info.fps);
+ env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.density, info.density);
+ env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.xDpi, info.xdpi);
+ env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.yDpi, info.ydpi);
+}
+
+
+static JNINativeMethod gSurfaceFlingerDisplayAdapterMethods[] = {
+ /* name, signature, funcPtr */
+ { "nativeGetDefaultDisplayDeviceInfo",
+ "(Lcom/android/server/display/DisplayDeviceInfo;)V",
+ (void*) nativeGetDefaultDisplayDeviceInfo },
+};
+
+#define FIND_CLASS(var, className) \
+ var = env->FindClass(className); \
+ LOG_FATAL_IF(! var, "Unable to find class " className);
+
+#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
+ var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
+ LOG_FATAL_IF(! var, "Unable to find field " fieldName);
+
+int register_android_server_display_SurfaceFlingerDisplayAdapter(JNIEnv* env) {
+ int res = jniRegisterNativeMethods(env,
+ "com/android/server/display/SurfaceFlingerDisplayAdapter",
+ gSurfaceFlingerDisplayAdapterMethods, NELEM(gSurfaceFlingerDisplayAdapterMethods));
+ LOG_FATAL_IF(res < 0, "Unable to register native methods.");
+
+ jclass clazz;
+ FIND_CLASS(clazz, "com/android/server/display/DisplayDeviceInfo");
+ GET_FIELD_ID(gDisplayDeviceInfoClassInfo.width, clazz, "width", "I");
+ GET_FIELD_ID(gDisplayDeviceInfoClassInfo.height, clazz, "height", "I");
+ GET_FIELD_ID(gDisplayDeviceInfoClassInfo.refreshRate, clazz, "refreshRate", "F");
+ GET_FIELD_ID(gDisplayDeviceInfoClassInfo.density, clazz, "density", "F");
+ GET_FIELD_ID(gDisplayDeviceInfoClassInfo.xDpi, clazz, "xDpi", "F");
+ GET_FIELD_ID(gDisplayDeviceInfoClassInfo.yDpi, clazz, "yDpi", "F");
+ return 0;
+}
+
+} /* namespace android */
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp
index 57e1c28e4077..35c21422b416 100644
--- a/services/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/jni/com_android_server_input_InputManagerService.cpp
@@ -903,7 +903,7 @@ void NativeInputManager::handleInterceptActions(jint wmActions, nsecs_t when,
#if DEBUG_INPUT_DISPATCHER_POLICY
ALOGD("handleInterceptActions: Poking user activity.");
#endif
- android_server_PowerManagerService_userActivity(when, POWER_MANAGER_BUTTON_EVENT);
+ android_server_PowerManagerService_userActivity(when, USER_ACTIVITY_EVENT_BUTTON);
}
if (wmActions & WM_ACTION_PASS_TO_USER) {
diff --git a/services/jni/com_android_server_power_PowerManagerService.cpp b/services/jni/com_android_server_power_PowerManagerService.cpp
index 2690b68efa17..acce97ea61ff 100644
--- a/services/jni/com_android_server_power_PowerManagerService.cpp
+++ b/services/jni/com_android_server_power_PowerManagerService.cpp
@@ -55,7 +55,7 @@ static Mutex gPowerManagerLock;
static bool gScreenOn;
static bool gScreenBright;
-static nsecs_t gLastEventTime[POWER_MANAGER_LAST_EVENT + 1];
+static nsecs_t gLastEventTime[USER_ACTIVITY_EVENT_LAST + 1];
// Throttling interval for user activity calls.
static const nsecs_t MIN_TIME_BETWEEN_USERACTIVITIES = 500 * 1000000L; // 500ms
@@ -92,7 +92,7 @@ void android_server_PowerManagerService_userActivity(nsecs_t eventTime, int32_t
// Throttle calls into user activity by event type.
// We're a little conservative about argument checking here in case the caller
// passes in bad data which could corrupt system state.
- if (eventType >= 0 && eventType <= POWER_MANAGER_LAST_EVENT) {
+ if (eventType >= 0 && eventType <= USER_ACTIVITY_EVENT_LAST) {
nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
if (eventTime > now) {
eventTime = now;
@@ -262,7 +262,7 @@ int register_android_server_PowerManagerService(JNIEnv* env) {
"userActivity", "(JZIZ)V");
// Initialize
- for (int i = 0; i < POWER_MANAGER_LAST_EVENT; i++) {
+ for (int i = 0; i <= USER_ACTIVITY_EVENT_LAST; i++) {
gLastEventTime[i] = LLONG_MIN;
}
gScreenOn = true;
diff --git a/services/jni/onload.cpp b/services/jni/onload.cpp
index 423ebd135027..50873fccf82a 100644
--- a/services/jni/onload.cpp
+++ b/services/jni/onload.cpp
@@ -22,6 +22,7 @@
namespace android {
int register_android_server_AlarmManagerService(JNIEnv* env);
int register_android_server_BatteryService(JNIEnv* env);
+int register_android_server_display_SurfaceFlingerDisplayAdapter(JNIEnv* env);
int register_android_server_InputApplicationHandle(JNIEnv* env);
int register_android_server_InputWindowHandle(JNIEnv* env);
int register_android_server_InputManager(JNIEnv* env);
@@ -51,6 +52,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
register_android_server_PowerManagerService(env);
register_android_server_SerialService(env);
+ register_android_server_display_SurfaceFlingerDisplayAdapter(env);
register_android_server_InputApplicationHandle(env);
register_android_server_InputWindowHandle(env);
register_android_server_InputManager(env);
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java
index 65c220f135c5..1f4f78e9d99d 100644
--- a/telephony/java/android/telephony/CellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 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.
@@ -20,70 +20,79 @@ import android.os.Parcel;
import android.os.Parcelable;
/**
- * CellIdentity is to represent ONE unique cell in the world
+ * CellIdentity is immutable and represents ONE unique cell in the world
* it contains all levels of info to identity country, carrier, etc.
*
- * @hide pending API review
+ * @hide
*/
public abstract class CellIdentity implements Parcelable {
- // Cell is a GSM Cell {@link GsmCellIdentity}
- public static final int CELLID_TYPE_GSM = 1;
- // Cell is a CMDA Cell {@link CdmaCellIdentity}
- public static final int CELLID_TYPE_CDMA = 2;
- // Cell is a LTE Cell {@link LteCellIdentity}
- public static final int CELLID_TYPE_LTE = 3;
+ // Type fields for parceling
+ protected static final int TYPE_GSM = 1;
+ protected static final int TYPE_CDMA = 2;
+ protected static final int TYPE_LTE = 3;
- private int mCellIdType;
- private String mCellIdAttributes;
-
- protected CellIdentity(int type, String attr) {
- this.mCellIdType = type;
- this.mCellIdAttributes = new String(attr);
+ protected CellIdentity() {
}
protected CellIdentity(Parcel in) {
- this.mCellIdType = in.readInt();
- this.mCellIdAttributes = new String(in.readString());
}
protected CellIdentity(CellIdentity cid) {
- this.mCellIdType = cid.mCellIdType;
- this.mCellIdAttributes = new String(cid.mCellIdAttributes);
}
/**
- * @return Cell Identity type as one of CELLID_TYPE_XXXX
+ * @return a copy of this object with package visibility.
*/
- public int getCellIdType() {
- return mCellIdType;
- }
+ abstract CellIdentity copy();
+ @Override
+ public abstract int hashCode();
- /**
- * @return Cell identity attribute pairs
- * Comma separated “key=value” pairs.
-     *   key := must must an single alpha-numeric word
- *   value := “quoted value string”
- *
-     * Current list of keys and values:
-     *   type = fixed | mobile
- */
- public String getCellIdAttributes() {
- return mCellIdAttributes;
+ @Override
+ public boolean equals(Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (this == other) {
+ return true;
+ }
+ return (other instanceof CellIdentity);
}
+ @Override
+ public String toString() {
+ return "";
+ }
- /** Implement the Parcelable interface {@hide} */
+ /** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
- /** Implement the Parcelable interface {@hide} */
+ /** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mCellIdType);
- dest.writeString(mCellIdAttributes);
}
+
+ /** Implement the Parcelable interface */
+ public static final Creator<CellIdentity> CREATOR =
+ new Creator<CellIdentity>() {
+ @Override
+ public CellIdentity createFromParcel(Parcel in) {
+ int type = in.readInt();
+ switch (type) {
+ case TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
+ case TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
+ case TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
+ default: throw new RuntimeException("Bad CellIdentity Parcel");
+ }
+ }
+
+ @Override
+ public CellIdentity[] newArray(int size) {
+ return new CellIdentity[size];
+ }
+ };
}
diff --git a/telephony/java/android/telephony/CdmaCellIdentity.java b/telephony/java/android/telephony/CellIdentityCdma.java
index 5b8454ff7288..0169d89e06bd 100644
--- a/telephony/java/android/telephony/CdmaCellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentityCdma.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 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.
@@ -18,13 +18,18 @@ package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.Log;
/**
* CellIdentity is to represent a unique CDMA cell
*
- * @hide pending API review
+ * @hide
*/
-public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
+public final class CellIdentityCdma extends CellIdentity implements Parcelable {
+
+ private static final String LOG_TAG = "CellSignalStrengthCdma";
+ private static final boolean DBG = false;
+
// Network Id 0..65535
private final int mNetworkId;
// CDMA System Id 0..32767
@@ -47,6 +52,17 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
private final int mLatitude;
/**
+ * @hide
+ */
+ public CellIdentityCdma() {
+ mNetworkId = Integer.MAX_VALUE;
+ mSystemId = Integer.MAX_VALUE;
+ mBasestationId = Integer.MAX_VALUE;
+ mLongitude = Integer.MAX_VALUE;
+ mLatitude = Integer.MAX_VALUE;
+ }
+
+ /**
* public constructor
* @param nid Network Id 0..65535
* @param sid CDMA System Id 0..32767
@@ -55,11 +71,10 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
* to 2592000
* @param lat Latitude is a decimal number ranges from -1296000
* to 1296000
- * @param attr is comma separated “key=value” attribute pairs.
+ *
+ * @hide
*/
- public CdmaCellIdentity (int nid, int sid,
- int bid, int lon, int lat, String attr) {
- super(CELLID_TYPE_CDMA, attr);
+ public CellIdentityCdma (int nid, int sid, int bid, int lon, int lat) {
mNetworkId = nid;
mSystemId = sid;
mBasestationId = bid;
@@ -67,16 +82,7 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
mLatitude = lat;
}
- private CdmaCellIdentity(Parcel in) {
- super(in);
- mNetworkId = in.readInt();
- mSystemId = in.readInt();
- mBasestationId = in.readInt();
- mLongitude = in.readInt();
- mLatitude = in.readInt();
- }
-
- CdmaCellIdentity(CdmaCellIdentity cid) {
+ private CellIdentityCdma(CellIdentityCdma cid) {
super(cid);
mNetworkId = cid.mNetworkId;
mSystemId = cid.mSystemId;
@@ -85,6 +91,11 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
mLatitude = cid.mLatitude;
}
+ @Override
+ CellIdentityCdma copy() {
+ return new CellIdentityCdma(this);
+ }
+
/**
* @return Network Id 0..65535
*/
@@ -118,9 +129,6 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
}
/**
- * @return Base station
- */
- /**
* @return Base station latitude, which is a decimal number as
* specified in 3GPP2 C.S0005-A v6.0. It is represented in units
* of 0.25 seconds and ranges from -1296000 to 1296000, both
@@ -131,15 +139,55 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
return mLatitude;
}
- /** Implement the Parcelable interface {@hide} */
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return (mNetworkId * primeNum) + (mSystemId * primeNum) + (mBasestationId * primeNum) +
+ (mLatitude * primeNum) + (mLongitude * primeNum);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (super.equals(other)) {
+ try {
+ CellIdentityCdma o = (CellIdentityCdma)other;
+ return mNetworkId == o.mNetworkId &&
+ mSystemId == o.mSystemId &&
+ mBasestationId == o.mBasestationId &&
+ mLatitude == o.mLatitude &&
+ mLongitude == o.mLongitude;
+ } catch (ClassCastException e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("CdmaCellIdentitiy:");
+ sb.append(super.toString());
+ sb.append(" mNetworkId="); sb.append(mNetworkId);
+ sb.append(" mSystemId="); sb.append(mSystemId);
+ sb.append(" mBasestationId="); sb.append(mBasestationId);
+ sb.append(" mLongitude="); sb.append(mLongitude);
+ sb.append(" mLatitude="); sb.append(mLatitude);
+
+ return sb.toString();
+ }
+
+ /** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
- /** Implement the Parcelable interface {@hide} */
+ /** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(TYPE_CDMA);
super.writeToParcel(dest, flags);
dest.writeInt(mNetworkId);
dest.writeInt(mSystemId);
@@ -148,17 +196,42 @@ public final class CdmaCellIdentity extends CellIdentity implements Parcelable {
dest.writeInt(mLatitude);
}
- /** Implement the Parcelable interface {@hide} */
- public static final Creator<CdmaCellIdentity> CREATOR =
- new Creator<CdmaCellIdentity>() {
+ /** Construct from Parcel, type has already been processed */
+ private CellIdentityCdma(Parcel in) {
+ super(in);
+ mNetworkId = in.readInt();
+ mSystemId = in.readInt();
+ mBasestationId = in.readInt();
+ mLongitude = in.readInt();
+ mLatitude = in.readInt();
+ if (DBG) log("CellIdentityCdma(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ @SuppressWarnings("hiding")
+ public static final Creator<CellIdentityCdma> CREATOR =
+ new Creator<CellIdentityCdma>() {
@Override
- public CdmaCellIdentity createFromParcel(Parcel in) {
- return new CdmaCellIdentity(in);
+ public CellIdentityCdma createFromParcel(Parcel in) {
+ in.readInt(); // Skip past token, we know what it is
+ return createFromParcelBody(in);
}
@Override
- public CdmaCellIdentity[] newArray(int size) {
- return new CdmaCellIdentity[size];
+ public CellIdentityCdma[] newArray(int size) {
+ return new CellIdentityCdma[size];
}
};
+
+ /** @hide */
+ static CellIdentityCdma createFromParcelBody(Parcel in) {
+ return new CellIdentityCdma(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
}
diff --git a/telephony/java/android/telephony/GsmCellIdentity.java b/telephony/java/android/telephony/CellIdentityGsm.java
index 159cb52b379d..f46cd4714c29 100644
--- a/telephony/java/android/telephony/GsmCellIdentity.java
+++ b/telephony/java/android/telephony/CellIdentityGsm.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 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.
@@ -18,13 +18,17 @@ package android.telephony;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.Log;
/**
* CellIdentity to represent a unique GSM or UMTS cell
*
- * @hide pending API review
+ * @hide
*/
-public final class GsmCellIdentity extends CellIdentity implements Parcelable {
+public final class CellIdentityGsm extends CellIdentity implements Parcelable {
+
+ private static final String LOG_TAG = "CellIdentityGsm";
+ private static final boolean DBG = false;
// 3-digit Mobile Country Code, 0..999
private final int mMcc;
@@ -39,17 +43,26 @@ public final class GsmCellIdentity extends CellIdentity implements Parcelable {
private final int mPsc;
/**
+ * @hide
+ */
+ public CellIdentityGsm() {
+ mMcc = Integer.MAX_VALUE;
+ mMnc = Integer.MAX_VALUE;
+ mLac = Integer.MAX_VALUE;
+ mCid = Integer.MAX_VALUE;
+ mPsc = Integer.MAX_VALUE;
+ }
+ /**
* public constructor
* @param mcc 3-digit Mobile Country Code, 0..999
* @param mnc 2 or 3-digit Mobile Network Code, 0..999
* @param lac 16-bit Location Area Code, 0..65535
* @param cid 16-bit GSM Cell Identity or 28-bit UMTS Cell Identity
* @param psc 9-bit UMTS Primary Scrambling Code
- * @param attr is comma separated “key=value” attribute pairs.
+ *
+ * @hide
*/
- public GsmCellIdentity (int mcc, int mnc,
- int lac, int cid, int psc, String attr) {
- super(CELLID_TYPE_GSM, attr);
+ public CellIdentityGsm (int mcc, int mnc, int lac, int cid, int psc) {
mMcc = mcc;
mMnc = mnc;
mLac = lac;
@@ -57,16 +70,7 @@ public final class GsmCellIdentity extends CellIdentity implements Parcelable {
mPsc = psc;
}
- private GsmCellIdentity(Parcel in) {
- super(in);
- mMcc = in.readInt();
- mMnc = in.readInt();
- mLac = in.readInt();
- mCid = in.readInt();
- mPsc = in.readInt();
- }
-
- GsmCellIdentity(GsmCellIdentity cid) {
+ private CellIdentityGsm(CellIdentityGsm cid) {
super(cid);
mMcc = cid.mMcc;
mMnc = cid.mMnc;
@@ -75,6 +79,11 @@ public final class GsmCellIdentity extends CellIdentity implements Parcelable {
mPsc = cid.mPsc;
}
+ @Override
+ CellIdentityGsm copy() {
+ return new CellIdentityGsm(this);
+ }
+
/**
* @return 3-digit Mobile Country Code, 0..999
*/
@@ -115,15 +124,55 @@ public final class GsmCellIdentity extends CellIdentity implements Parcelable {
return mPsc;
}
- /** Implement the Parcelable interface {@hide} */
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return (mMcc * primeNum) + (mMnc * primeNum) + (mLac * primeNum) + (mCid * primeNum) +
+ (mPsc * primeNum);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (super.equals(other)) {
+ try {
+ CellIdentityGsm o = (CellIdentityGsm)other;
+ return mMcc == o.mMcc &&
+ mMnc == o.mMnc &&
+ mLac == o.mLac &&
+ mCid == o.mCid &&
+ mPsc == o.mPsc;
+ } catch (ClassCastException e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("GsmCellIdentitiy:");
+ sb.append(super.toString());
+ sb.append(" mMcc=").append(mMcc);
+ sb.append(" mMnc=").append(mMcc);
+ sb.append(" mLac=").append(mLac);
+ sb.append(" mCid=").append(mCid);
+ sb.append(" mPsc=").append(mPsc);
+
+ return sb.toString();
+ }
+
+ /** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
- /** Implement the Parcelable interface {@hide} */
+ /** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(TYPE_GSM);
super.writeToParcel(dest, flags);
dest.writeInt(mMcc);
dest.writeInt(mMnc);
@@ -132,17 +181,42 @@ public final class GsmCellIdentity extends CellIdentity implements Parcelable {
dest.writeInt(mPsc);
}
- /** Implement the Parcelable interface {@hide} */
- public static final Creator<GsmCellIdentity> CREATOR =
- new Creator<GsmCellIdentity>() {
+ /** Construct from Parcel, type has already been processed */
+ private CellIdentityGsm(Parcel in) {
+ super(in);
+ mMcc = in.readInt();
+ mMnc = in.readInt();
+ mLac = in.readInt();
+ mCid = in.readInt();
+ mPsc = in.readInt();
+ if (DBG) log("CellIdentityGsm(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ @SuppressWarnings("hiding")
+ public static final Creator<CellIdentityGsm> CREATOR =
+ new Creator<CellIdentityGsm>() {
@Override
- public GsmCellIdentity createFromParcel(Parcel in) {
- return new GsmCellIdentity(in);
+ public CellIdentityGsm createFromParcel(Parcel in) {
+ in.readInt(); // Skip past token, we know what it is
+ return createFromParcelBody(in);
}
@Override
- public GsmCellIdentity[] newArray(int size) {
- return new GsmCellIdentity[size];
+ public CellIdentityGsm[] newArray(int size) {
+ return new CellIdentityGsm[size];
}
};
+
+ /** @hide */
+ static CellIdentityGsm createFromParcelBody(Parcel in) {
+ return new CellIdentityGsm(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
}
diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java
new file mode 100644
index 000000000000..3d8532d15b71
--- /dev/null
+++ b/telephony/java/android/telephony/CellIdentityLte.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * CellIdentity is to represent a unique LTE cell
+ *
+ * @hide
+ */
+public final class CellIdentityLte extends CellIdentity implements Parcelable {
+
+ private static final String LOG_TAG = "CellIdentityLte";
+ private static final boolean DBG = false;
+
+ // 3-digit Mobile Country Code, 0..999
+ private final int mMcc;
+ // 2 or 3-digit Mobile Network Code, 0..999
+ private final int mMnc;
+ // 28-bit cell identity
+ private final int mCi;
+ // physical cell id 0..503
+ private final int mPci;
+ // 16-bit tracking area code
+ private final int mTac;
+
+ /**
+ * @hide
+ */
+ public CellIdentityLte() {
+ mMcc = Integer.MAX_VALUE;
+ mMnc = Integer.MAX_VALUE;
+ mCi = Integer.MAX_VALUE;
+ mPci = Integer.MAX_VALUE;
+ mTac = Integer.MAX_VALUE;
+ }
+
+ /**
+ *
+ * @param mcc 3-digit Mobile Country Code, 0..999
+ * @param mnc 2 or 3-digit Mobile Network Code, 0..999
+ * @param ci 28-bit Cell Identity
+ * @param pci Physical Cell Id 0..503
+ * @param tac 16-bit Tracking Area Code
+ *
+ * @hide
+ */
+ public CellIdentityLte (int mcc, int mnc, int ci, int pci, int tac) {
+ mMcc = mcc;
+ mMnc = mnc;
+ mCi = ci;
+ mPci = pci;
+ mTac = tac;
+ }
+
+ private CellIdentityLte(CellIdentityLte cid) {
+ super(cid);
+ mMcc = cid.mMcc;
+ mMnc = cid.mMnc;
+ mCi = cid.mCi;
+ mPci = cid.mPci;
+ mTac = cid.mTac;
+ }
+
+ @Override
+ CellIdentityLte copy() {
+ return new CellIdentityLte(this);
+ }
+
+ /**
+ * @return 3-digit Mobile Country Code, 0..999
+ */
+ public int getMcc() {
+ return mMcc;
+ }
+
+ /**
+ * @return 2 or 3-digit Mobile Network Code, 0..999
+ */
+ public int getMnc() {
+ return mMnc;
+ }
+
+ /**
+ * @return 28-bit Cell Identity
+ */
+ public int getCi() {
+ return mCi;
+ }
+
+ /**
+ * @return Physical Cell Id 0..503
+ */
+ public int getPci() {
+ return mPci;
+ }
+
+ /**
+ * @return 16-bit Tracking Area Code
+ */
+ public int getTac() {
+ return mTac;
+ }
+
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return (mMcc * primeNum) + (mMnc * primeNum) + (mCi * primeNum) + (mPci * primeNum) +
+ (mTac * primeNum);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (super.equals(other)) {
+ try {
+ CellIdentityLte o = (CellIdentityLte)other;
+ return mMcc == o.mMcc &&
+ mMnc == o.mMnc &&
+ mCi == o.mCi &&
+ mPci == o.mCi &&
+ mTac == o.mTac;
+ } catch (ClassCastException e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("LteCellIdentitiy:");
+ sb.append(super.toString());
+ sb.append(" mMcc="); sb.append(mMcc);
+ sb.append(" mMnc="); sb.append(mMnc);
+ sb.append(" mCi="); sb.append(mCi);
+ sb.append(" mPci="); sb.append(mPci);
+ sb.append(" mTac="); sb.append(mTac);
+
+ return sb.toString();
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(TYPE_LTE);
+ super.writeToParcel(dest, flags);
+ dest.writeInt(mMcc);
+ dest.writeInt(mMnc);
+ dest.writeInt(mCi);
+ dest.writeInt(mPci);
+ dest.writeInt(mTac);
+ }
+
+ /** Construct from Parcel, type has already been processed */
+ private CellIdentityLte(Parcel in) {
+ super(in);
+ mMcc = in.readInt();
+ mMnc = in.readInt();
+ mCi = in.readInt();
+ mPci = in.readInt();
+ mTac = in.readInt();
+ if (DBG) log("CellIdentityLte(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ @SuppressWarnings("hiding")
+ public static final Creator<CellIdentityLte> CREATOR =
+ new Creator<CellIdentityLte>() {
+ @Override
+ public CellIdentityLte createFromParcel(Parcel in) {
+ in.readInt(); // Skip past token, we know what it is
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellIdentityLte[] newArray(int size) {
+ return new CellIdentityLte[size];
+ }
+ };
+
+ /** @hide */
+ static CellIdentityLte createFromParcelBody(Parcel in) {
+ return new CellIdentityLte(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index 9bea30c2d70d..5fdf7c0bb7c5 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 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.
@@ -20,194 +20,171 @@ import android.os.Parcel;
import android.os.Parcelable;
/**
- * Represent one snapshot observation of one cell info
- * which contains the time of observation.
+ * Immutable cell information from a point in time.
*
- * @hide Pending API review
+ * @hide
*/
-public final class CellInfo implements Parcelable {
- // Type to distinguish where time stamp gets recorded.
- public static final int CELL_INFO_TIMESTAMP_TYPE_UNKNOWN = 0;
- public static final int CELL_INFO_TIMESTAMP_TYPE_ANTENNA = 1;
- public static final int CELL_INFO_TIMESTAMP_TYPE_MODEM = 2;
- public static final int CELL_INFO_TIMESTAMP_TYPE_OEM_RIL = 3;
- public static final int CELL_INFO_TIMESTAMP_TYPE_JAVA_RIL = 4;
+public class CellInfo implements Parcelable {
- // Observation time stamped as type in nanoseconds since boot
- private final long mTimeStamp;
- // Where time stamp gets recorded.
- // Value of CELL_INFO_TIMESTAMP_TYPE_XXXX
- private final int mTimeStampType;
+ // Type fields for parceling
+ protected static final int TYPE_GSM = 1;
+ protected static final int TYPE_CDMA = 2;
+ protected static final int TYPE_LTE = 3;
- private final boolean mRegistered;
+ // Type to distinguish where time stamp gets recorded.
- private final SignalStrength mStrength;
- private final long mTimingAdvance;
+ /** @hide */
+ public static final int TIMESTAMP_TYPE_UNKNOWN = 0;
+ /** @hide */
+ public static final int TIMESTAMP_TYPE_ANTENNA = 1;
+ /** @hide */
+ public static final int TIMESTAMP_TYPE_MODEM = 2;
+ /** @hide */
+ public static final int TIMESTAMP_TYPE_OEM_RIL = 3;
+ /** @hide */
+ public static final int TIMESTAMP_TYPE_JAVA_RIL = 4;
- private final int mCellIdentityType;
- private final CellIdentity mCellIdentity;
+ // True if device is mRegistered to the mobile network
+ private boolean mRegistered;
- /**
- * Public constructor
- * @param timeStampType is one of CELL_INFO_TIMESTAMP_TYPE_XXXX
- * @param timeStamp is observation time in nanoseconds since boot
- * @param timingAdv is observed timing advance
- * @param registered is true when register to this cellIdentity
- * @param strength is observed signal strength
- * @param cellIdentity is observed mobile cell
- */
- public CellInfo(int timeStampType, long timeStamp, long timingAdv,
- boolean registered, SignalStrength strength,
- CellIdentity cellIdentity) {
-
- if (timeStampType < CELL_INFO_TIMESTAMP_TYPE_UNKNOWN ||
- timeStampType > CELL_INFO_TIMESTAMP_TYPE_JAVA_RIL) {
- mTimeStampType = CELL_INFO_TIMESTAMP_TYPE_UNKNOWN;
- } else {
- mTimeStampType = timeStampType;
- }
+ // Observation time stamped as type in nanoseconds since boot
+ private long mTimeStamp;
- mRegistered = registered;
- mTimeStamp = timeStamp;
- mTimingAdvance = timingAdv;
- mStrength = new SignalStrength(strength);
+ // Where time stamp gets recorded.
+ // Value of TIMESTAMP_TYPE_XXXX
+ private int mTimeStampType;
- mCellIdentityType = cellIdentity.getCellIdType();
- // TODO: make defense copy
- mCellIdentity = cellIdentity;
+ protected CellInfo() {
+ this.mRegistered = false;
+ this.mTimeStampType = TIMESTAMP_TYPE_UNKNOWN;
+ this.mTimeStamp = Long.MAX_VALUE;
}
- public CellInfo(CellInfo ci) {
- this.mTimeStampType = ci.mTimeStampType;
+ protected CellInfo(CellInfo ci) {
this.mRegistered = ci.mRegistered;
+ this.mTimeStampType = ci.mTimeStampType;
this.mTimeStamp = ci.mTimeStamp;
- this.mTimingAdvance = ci.mTimingAdvance;
- this.mCellIdentityType = ci.mCellIdentityType;
- this.mStrength = new SignalStrength(ci.mStrength);
- switch(mCellIdentityType) {
- case CellIdentity.CELLID_TYPE_GSM:
- mCellIdentity = new GsmCellIdentity((GsmCellIdentity)ci.mCellIdentity);
- break;
- default:
- mCellIdentity = null;
- }
}
- private CellInfo(Parcel in) {
- mTimeStampType = in.readInt();
- mRegistered = (in.readInt() == 1) ? true : false;
- mTimeStamp = in.readLong();
- mTimingAdvance = in.readLong();
- mCellIdentityType = in.readInt();
- mStrength = SignalStrength.CREATOR.createFromParcel(in);
- switch(mCellIdentityType) {
- case CellIdentity.CELLID_TYPE_GSM:
- mCellIdentity = GsmCellIdentity.CREATOR.createFromParcel(in);
- break;
- default:
- mCellIdentity = null;
- }
+ /** True if this cell is registered to the mobile network */
+ public boolean isRegistered() {
+ return mRegistered;
+ }
+ /** @hide */
+ public void setRegisterd(boolean registered) {
+ mRegistered = registered;
}
- /**
- * @return the observation time in nanoseconds since boot
- */
+ /** Approximate time of this cell information in nanos since boot */
public long getTimeStamp() {
return mTimeStamp;
}
+ /** @hide */
+ public void setTimeStamp(long timeStamp) {
+ mTimeStamp = timeStamp;
+ }
/**
- * @return Where time stamp gets recorded.
- * one of CELL_INFO_TIMESTAMP_TYPE_XXXX
+ * Where time stamp gets recorded.
+ * @return one of TIMESTAMP_TYPE_XXXX
+ *
+ * @hide
*/
public int getTimeStampType() {
return mTimeStampType;
}
-
- /**
- * @return true when register to this cellIdentity
- */
- public boolean isRegistered() {
- return mRegistered;
- }
-
- /**
- * @return observed timing advance
- */
- public long getTimingAdvance() {
- return mTimingAdvance;
- }
-
- /**
- * @return observed signal strength
- */
- public SignalStrength getSignalStrength() {
- // make a defense copy
- return new SignalStrength(mStrength);
+ /** @hide */
+ public void setTimeStampType(int timeStampType) {
+ if (timeStampType < TIMESTAMP_TYPE_UNKNOWN || timeStampType > TIMESTAMP_TYPE_JAVA_RIL) {
+ mTimeStampType = TIMESTAMP_TYPE_UNKNOWN;
+ } else {
+ mTimeStampType = timeStampType;
+ }
}
- /**
- * @return observed cell identity
- */
- public CellIdentity getCellIdentity() {
- // TODO: make a defense copy
- return mCellIdentity;
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return ((mRegistered ? 0 : 1) * primeNum) + ((int)(mTimeStamp / 1000) * primeNum)
+ + (mTimeStampType * primeNum);
}
@Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
+ public boolean equals(Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (this == other) {
+ return true;
+ }
+ try {
+ CellInfo o = (CellInfo) other;
+ return mRegistered == o.mRegistered
+ && mTimeStamp == o.mTimeStamp && mTimeStampType == o.mTimeStampType;
+ } catch (ClassCastException e) {
+ return false;
+ }
+ }
- sb.append("TimeStampType: ");
- switch(mTimeStampType) {
+ private static String timeStampTypeToString(int type) {
+ switch (type) {
case 1:
- sb.append("antenna");
- break;
+ return "antenna";
case 2:
- sb.append("modem");
- break;
+ return "modem";
case 3:
- sb.append("oem_ril");
- break;
+ return "oem_ril";
case 4:
- sb.append("java_ril");
- break;
+ return "java_ril";
default:
- sb.append("unknown");
+ return "unknown";
}
- sb.append(", TimeStamp: ").append(mTimeStamp).append(" ns");
- sb.append(", Registered: ").append(mRegistered ? "YES" : "NO");
- sb.append(", TimingAdvance: ").append(mTimingAdvance);
- sb.append(", Strength : " + mStrength);
- sb.append(", Cell Iden: " + mCellIdentity);
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ String timeStampType;
+
+ sb.append(" mRegistered=").append(mRegistered ? "YES" : "NO");
+ timeStampType = timeStampTypeToString(mTimeStampType);
+ sb.append(" mTimeStampType=").append(timeStampType);
+ sb.append(" mTimeStamp=").append(mTimeStamp).append("ns");
return sb.toString();
}
- /** Implement the Parcelable interface {@hide} */
+ /** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
- /** Implement the Parcelable interface {@hide} */
+ /** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mTimeStampType);
dest.writeInt(mRegistered ? 1 : 0);
+ dest.writeInt(mTimeStampType);
dest.writeLong(mTimeStamp);
- dest.writeLong(mTimingAdvance);
- dest.writeInt(mCellIdentityType);
- mStrength.writeToParcel(dest, flags);
- mCellIdentity.writeToParcel(dest, flags);
}
- /** Implement the Parcelable interface {@hide} */
- public static final Creator<CellInfo> CREATOR =
- new Creator<CellInfo>() {
+ protected CellInfo(Parcel in) {
+ mRegistered = (in.readInt() == 1) ? true : false;
+ mTimeStampType = in.readInt();
+ mTimeStamp = in.readLong();
+ }
+
+ /** Implement the Parcelable interface */
+ public static final Creator<CellInfo> CREATOR = new Creator<CellInfo>() {
@Override
public CellInfo createFromParcel(Parcel in) {
- return new CellInfo(in);
+ int type = in.readInt();
+ switch (type) {
+ case TYPE_GSM: return CellInfoGsm.createFromParcelBody(in);
+ case TYPE_CDMA: return CellInfoCdma.createFromParcelBody(in);
+ case TYPE_LTE: return CellInfoLte.createFromParcelBody(in);
+ default: throw new RuntimeException("Bad CellInfo Parcel");
+ }
}
@Override
diff --git a/telephony/java/android/telephony/CellInfoCdma.java b/telephony/java/android/telephony/CellInfoCdma.java
new file mode 100644
index 000000000000..84c1560b769e
--- /dev/null
+++ b/telephony/java/android/telephony/CellInfoCdma.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * Immutable cell information from a point in time.
+ *
+ * @hide
+ */
+public final class CellInfoCdma extends CellInfo implements Parcelable {
+
+ private static final String LOG_TAG = "CellInfoCdma";
+ private static final boolean DBG = false;
+
+ private CellIdentityCdma mCellIdentityCdma;
+ private CellSignalStrengthCdma mCellSignalStrengthCdma;
+
+ /** @hide */
+ public CellInfoCdma() {
+ super();
+ mCellIdentityCdma = new CellIdentityCdma();
+ mCellSignalStrengthCdma = new CellSignalStrengthCdma();
+ }
+
+ /** @hide */
+ public CellInfoCdma(CellInfoCdma ci) {
+ super(ci);
+ this.mCellIdentityCdma = ci.mCellIdentityCdma.copy();
+ this.mCellSignalStrengthCdma = ci.mCellSignalStrengthCdma.copy();
+ }
+
+ public CellIdentityCdma getCellIdentity() {
+ return mCellIdentityCdma;
+ }
+ /** @hide */
+ public void setCellIdentity(CellIdentityCdma cid) {
+ mCellIdentityCdma = cid;
+ }
+
+ public CellSignalStrengthCdma getCellSignalStrength() {
+ return mCellSignalStrengthCdma;
+ }
+ /** @hide */
+ public void setCellSignalStrength(CellSignalStrengthCdma css) {
+ mCellSignalStrengthCdma = css;
+ }
+
+ /**
+ * @return hash code
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode() + mCellIdentityCdma.hashCode() + mCellSignalStrengthCdma.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!super.equals(other)) {
+ return false;
+ }
+ try {
+ CellInfoCdma o = (CellInfoCdma) other;
+ return mCellIdentityCdma.equals(o.mCellIdentityCdma)
+ && mCellSignalStrengthCdma.equals(o.mCellSignalStrengthCdma);
+ } catch (ClassCastException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("CellInfoCdma:");
+ sb.append(super.toString());
+ sb.append(", ").append(mCellIdentityCdma);
+ sb.append(", ").append(mCellSignalStrengthCdma);
+
+ return sb.toString();
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(TYPE_LTE);
+ super.writeToParcel(dest, flags);
+ mCellIdentityCdma.writeToParcel(dest, flags);
+ mCellSignalStrengthCdma.writeToParcel(dest, flags);
+ }
+
+ /**
+ * Construct a CellInfoCdma object from the given parcel
+ * where the token is already been processed.
+ */
+ private CellInfoCdma(Parcel in) {
+ super(in);
+ mCellIdentityCdma = CellIdentityCdma.CREATOR.createFromParcel(in);
+ mCellSignalStrengthCdma = CellSignalStrengthCdma.CREATOR.createFromParcel(in);
+ if (DBG) log("CellInfoCdma(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ public static final Creator<CellInfoCdma> CREATOR = new Creator<CellInfoCdma>() {
+ @Override
+ public CellInfoCdma createFromParcel(Parcel in) {
+ in.readInt(); // Skip past token, we know what it is
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellInfoCdma[] newArray(int size) {
+ return new CellInfoCdma[size];
+ }
+ };
+
+ /** @hide */
+ protected static CellInfoCdma createFromParcelBody(Parcel in) {
+ return new CellInfoCdma(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/CellInfoGsm.java b/telephony/java/android/telephony/CellInfoGsm.java
new file mode 100644
index 000000000000..f913569a159a
--- /dev/null
+++ b/telephony/java/android/telephony/CellInfoGsm.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * Immutable cell information from a point in time.
+ *
+ * @hide
+ */
+public final class CellInfoGsm extends CellInfo implements Parcelable {
+
+ private static final String LOG_TAG = "CellInfoGsm";
+ private static final boolean DBG = false;
+
+ private CellIdentityGsm mCellIdentityGsm;
+ private CellSignalStrengthGsm mCellSignalStrengthGsm;
+
+ /** @hide */
+ public CellInfoGsm() {
+ super();
+ mCellIdentityGsm = new CellIdentityGsm();
+ mCellSignalStrengthGsm = new CellSignalStrengthGsm();
+ }
+
+ /** @hide */
+ public CellInfoGsm(CellInfoGsm ci) {
+ super(ci);
+ this.mCellIdentityGsm = ci.mCellIdentityGsm.copy();
+ this.mCellSignalStrengthGsm = ci.mCellSignalStrengthGsm.copy();
+ }
+
+ public CellIdentityGsm getCellIdentity() {
+ return mCellIdentityGsm;
+ }
+ /** @hide */
+ public void setCellIdentity(CellIdentityGsm cid) {
+ mCellIdentityGsm = cid;
+ }
+
+ public CellSignalStrengthGsm getCellSignalStrength() {
+ return mCellSignalStrengthGsm;
+ }
+ /** @hide */
+ public void setCellSignalStrength(CellSignalStrengthGsm css) {
+ mCellSignalStrengthGsm = css;
+ }
+
+ /**
+ * @return hash code
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode() + mCellIdentityGsm.hashCode() + mCellSignalStrengthGsm.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!super.equals(other)) {
+ return false;
+ }
+ try {
+ CellInfoGsm o = (CellInfoGsm) other;
+ return mCellIdentityGsm.equals(o.mCellIdentityGsm)
+ && mCellSignalStrengthGsm.equals(o.mCellSignalStrengthGsm);
+ } catch (ClassCastException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("CellInfoGsm:");
+ sb.append(super.toString());
+ sb.append(", ").append(mCellIdentityGsm);
+ sb.append(", ").append(mCellSignalStrengthGsm);
+
+ return sb.toString();
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(TYPE_LTE);
+ super.writeToParcel(dest, flags);
+ mCellIdentityGsm.writeToParcel(dest, flags);
+ mCellSignalStrengthGsm.writeToParcel(dest, flags);
+ }
+
+ /**
+ * Construct a CellInfoGsm object from the given parcel
+ * where the token is already been processed.
+ */
+ private CellInfoGsm(Parcel in) {
+ super(in);
+ mCellIdentityGsm = CellIdentityGsm.CREATOR.createFromParcel(in);
+ mCellSignalStrengthGsm = CellSignalStrengthGsm.CREATOR.createFromParcel(in);
+ }
+
+ /** Implement the Parcelable interface */
+ public static final Creator<CellInfoGsm> CREATOR = new Creator<CellInfoGsm>() {
+ @Override
+ public CellInfoGsm createFromParcel(Parcel in) {
+ in.readInt(); // Skip past token, we know what it is
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellInfoGsm[] newArray(int size) {
+ return new CellInfoGsm[size];
+ }
+ };
+
+ /** @hide */
+ protected static CellInfoGsm createFromParcelBody(Parcel in) {
+ return new CellInfoGsm(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/CellInfoLte.java b/telephony/java/android/telephony/CellInfoLte.java
new file mode 100644
index 000000000000..57b040223a88
--- /dev/null
+++ b/telephony/java/android/telephony/CellInfoLte.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * Immutable cell information from a point in time.
+ *
+ * @hide
+ */
+public final class CellInfoLte extends CellInfo implements Parcelable {
+
+ private static final String LOG_TAG = "CellInfoLte";
+ private static final boolean DBG = false;
+
+ private CellIdentityLte mCellIdentityLte;
+ private CellSignalStrengthLte mCellSignalStrengthLte;
+
+ /** @hide */
+ public CellInfoLte() {
+ super();
+ mCellIdentityLte = new CellIdentityLte();
+ mCellSignalStrengthLte = new CellSignalStrengthLte();
+ }
+
+ /** @hide */
+ public CellInfoLte(CellInfoLte ci) {
+ super(ci);
+ this.mCellIdentityLte = ci.mCellIdentityLte.copy();
+ this.mCellSignalStrengthLte = ci.mCellSignalStrengthLte.copy();
+ }
+
+ public CellIdentityLte getCellIdentity() {
+ return mCellIdentityLte;
+ }
+ /** @hide */
+ public void setCellIdentity(CellIdentityLte cid) {
+ mCellIdentityLte = cid;
+ }
+
+ public CellSignalStrengthLte getCellSignalStrength() {
+ return mCellSignalStrengthLte;
+ }
+ /** @hide */
+ public void setCellSignalStrength(CellSignalStrengthLte css) {
+ mCellSignalStrengthLte = css;
+ }
+
+ /**
+ * @return hash code
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode() + mCellIdentityLte.hashCode() + mCellSignalStrengthLte.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!super.equals(other)) {
+ return false;
+ }
+ try {
+ CellInfoLte o = (CellInfoLte) other;
+ return mCellIdentityLte.equals(o.mCellIdentityLte)
+ && mCellSignalStrengthLte.equals(o.mCellSignalStrengthLte);
+ } catch (ClassCastException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("CellInfoLte:");
+ sb.append(super.toString());
+ sb.append(", ").append(mCellIdentityLte);
+ sb.append(", ").append(mCellSignalStrengthLte);
+
+ return sb.toString();
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(TYPE_LTE);
+ super.writeToParcel(dest, flags);
+ mCellIdentityLte.writeToParcel(dest, flags);
+ mCellSignalStrengthLte.writeToParcel(dest, flags);
+ }
+
+ /**
+ * Construct a CellInfoLte object from the given parcel
+ * where the TYPE_LTE token is already been processed.
+ */
+ private CellInfoLte(Parcel in) {
+ super(in);
+ mCellIdentityLte = CellIdentityLte.CREATOR.createFromParcel(in);
+ mCellSignalStrengthLte = CellSignalStrengthLte.CREATOR.createFromParcel(in);
+ if (DBG) log("CellInfoLte(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ public static final Creator<CellInfoLte> CREATOR = new Creator<CellInfoLte>() {
+ @Override
+ public CellInfoLte createFromParcel(Parcel in) {
+ in.readInt(); // Skip past token, we know what it is
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellInfoLte[] newArray(int size) {
+ return new CellInfoLte[size];
+ }
+ };
+
+ /** @hide */
+ protected static CellInfoLte createFromParcelBody(Parcel in) {
+ return new CellInfoLte(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/CellSignalStrength.java b/telephony/java/android/telephony/CellSignalStrength.java
new file mode 100644
index 000000000000..4ed7dcfff08e
--- /dev/null
+++ b/telephony/java/android/telephony/CellSignalStrength.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.view.InputEvent;
+
+/**
+ * Abstract base class for cell phone signal strength related information.
+ *
+ * @hide
+ */
+public abstract class CellSignalStrength implements Parcelable {
+
+ // Type fields for parceling
+ protected static final int TYPE_GSM = 1;
+ protected static final int TYPE_CDMA = 2;
+ protected static final int TYPE_LTE = 3;
+
+
+ /** @hide */
+ public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
+ /** @hide */
+ public static final int SIGNAL_STRENGTH_POOR = 1;
+ /** @hide */
+ public static final int SIGNAL_STRENGTH_MODERATE = 2;
+ /** @hide */
+ public static final int SIGNAL_STRENGTH_GOOD = 3;
+ /** @hide */
+ public static final int SIGNAL_STRENGTH_GREAT = 4;
+ /** @hide */
+ public static final int NUM_SIGNAL_STRENGTH_BINS = 5;
+ /** @hide */
+ public static final String[] SIGNAL_STRENGTH_NAMES = {
+ "none", "poor", "moderate", "good", "great"
+ };
+
+ /** @hide */
+ public abstract void setDefaultValues();
+
+ /**
+ * Get signal level as an int from 0..4
+ *
+ * @hide
+ */
+ public abstract int getLevel();
+
+ /**
+ * Get the signal level as an asu value between 0..31, 99 is unknown
+ *
+ * @hide
+ */
+ public abstract int getAsuLevel();
+
+ /**
+ * Get the signal strength as dBm
+ *
+ * @hide
+ */
+ public abstract int getDbm();
+
+ /**
+ * Copies the CellSignalStrength.
+ *
+ * @return A deep copy of this class.
+ * @hide
+ */
+ public abstract CellSignalStrength copy();
+
+ @Override
+ public abstract int hashCode();
+
+ @Override
+ public abstract boolean equals (Object o);
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public abstract void writeToParcel(Parcel dest, int flags);
+
+ /** Implement the Parcelable interface */
+ public static final Creator<CellSignalStrength> CREATOR =
+ new Creator<CellSignalStrength>() {
+ @Override
+ public CellSignalStrength createFromParcel(Parcel in) {
+ int type = in.readInt();
+ switch (type) {
+ case TYPE_GSM: return CellSignalStrengthGsm.createFromParcelBody(in);
+ case TYPE_CDMA: return CellSignalStrengthCdma.createFromParcelBody(in);
+ case TYPE_LTE: return CellSignalStrengthLte.createFromParcelBody(in);
+ default: throw new RuntimeException("Bad CellSignalStrength Parcel");
+ }
+ }
+
+ @Override
+ public CellSignalStrength[] newArray(int size) {
+ return new CellSignalStrength[size];
+ }
+ };
+}
diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java
new file mode 100644
index 000000000000..ee50fad02fba
--- /dev/null
+++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java
@@ -0,0 +1,402 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * LTE signal strength related information.
+ *
+ * @hide
+ */
+public class CellSignalStrengthCdma extends CellSignalStrength implements Parcelable {
+
+ private static final String LOG_TAG = "CellSignalStrengthCdma";
+ private static final boolean DBG = false;
+
+ private int mCdmaDbm; // This value is the RSSI value
+ private int mCdmaEcio; // This value is the Ec/Io
+ private int mEvdoDbm; // This value is the EVDO RSSI value
+ private int mEvdoEcio; // This value is the EVDO Ec/Io
+ private int mEvdoSnr; // Valid values are 0-8. 8 is the highest signal to noise ratio
+
+ /**
+ * Empty constructor
+ *
+ * @hide
+ */
+ public CellSignalStrengthCdma() {
+ setDefaultValues();
+ }
+
+ /**
+ * Constructor
+ *
+ * @hide
+ */
+ public CellSignalStrengthCdma(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio,
+ int evdoSnr) {
+ initialize(cdmaDbm, cdmaEcio, evdoDbm, evdoEcio, evdoSnr);
+ }
+
+ /**
+ * Copy constructors
+ *
+ * @param s Source SignalStrength
+ *
+ * @hide
+ */
+ public CellSignalStrengthCdma(CellSignalStrengthCdma s) {
+ copyFrom(s);
+ }
+
+ /**
+ * Initialize all the values
+ *
+ * @param cdmaDbm
+ * @param cdmaEcio
+ * @param evdoDbm
+ * @param evdoEcio
+ * @param evdoSnr
+ *
+ * @hide
+ */
+ public void initialize(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio, int evdoSnr) {
+ mCdmaDbm = cdmaDbm;
+ mCdmaEcio = cdmaEcio;
+ mEvdoDbm = evdoDbm;
+ mEvdoEcio = evdoEcio;
+ mEvdoSnr = evdoSnr;
+ }
+
+ /**
+ * @hide
+ */
+ protected void copyFrom(CellSignalStrengthCdma s) {
+ mCdmaDbm = s.mCdmaDbm;
+ mCdmaEcio = s.mCdmaEcio;
+ mEvdoDbm = s.mEvdoDbm;
+ mEvdoEcio = s.mEvdoEcio;
+ mEvdoSnr = s.mEvdoSnr;
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public CellSignalStrengthCdma copy() {
+ return new CellSignalStrengthCdma(this);
+ }
+
+ /** @hide */
+ @Override
+ public void setDefaultValues() {
+ mCdmaDbm = Integer.MAX_VALUE;
+ mCdmaEcio = Integer.MAX_VALUE;
+ mEvdoDbm = Integer.MAX_VALUE;
+ mEvdoEcio = Integer.MAX_VALUE;
+ mEvdoSnr = Integer.MAX_VALUE;
+ }
+
+ /**
+ * Get LTE as level 0..4
+ *
+ * @hide
+ */
+ @Override
+ public int getLevel() {
+ int level;
+
+ int cdmaLevel = getCdmaLevel();
+ int evdoLevel = getEvdoLevel();
+ if (evdoLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ /* We don't know evdo, use cdma */
+ level = getCdmaLevel();
+ } else if (cdmaLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+ /* We don't know cdma, use evdo */
+ level = getEvdoLevel();
+ } else {
+ /* We know both, use the lowest level */
+ level = cdmaLevel < evdoLevel ? cdmaLevel : evdoLevel;
+ }
+ if (DBG) log("getLevel=" + level);
+ return level;
+ }
+
+ /**
+ * Get the LTE signal level as an asu value between 0..97, 99 is unknown
+ * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
+ *
+ * @hide
+ */
+ @Override
+ public int getAsuLevel() {
+ final int cdmaDbm = getCdmaDbm();
+ final int cdmaEcio = getCdmaEcio();
+ int cdmaAsuLevel;
+ int ecioAsuLevel;
+
+ if (cdmaDbm >= -75) cdmaAsuLevel = 16;
+ else if (cdmaDbm >= -82) cdmaAsuLevel = 8;
+ else if (cdmaDbm >= -90) cdmaAsuLevel = 4;
+ else if (cdmaDbm >= -95) cdmaAsuLevel = 2;
+ else if (cdmaDbm >= -100) cdmaAsuLevel = 1;
+ else cdmaAsuLevel = 99;
+
+ // Ec/Io are in dB*10
+ if (cdmaEcio >= -90) ecioAsuLevel = 16;
+ else if (cdmaEcio >= -100) ecioAsuLevel = 8;
+ else if (cdmaEcio >= -115) ecioAsuLevel = 4;
+ else if (cdmaEcio >= -130) ecioAsuLevel = 2;
+ else if (cdmaEcio >= -150) ecioAsuLevel = 1;
+ else ecioAsuLevel = 99;
+
+ int level = (cdmaAsuLevel < ecioAsuLevel) ? cdmaAsuLevel : ecioAsuLevel;
+ if (DBG) log("getAsuLevel=" + level);
+ return level;
+ }
+
+ /**
+ * Get cdma as level 0..4
+ *
+ * @hide
+ */
+ public int getCdmaLevel() {
+ final int cdmaDbm = getCdmaDbm();
+ final int cdmaEcio = getCdmaEcio();
+ int levelDbm;
+ int levelEcio;
+
+ if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT;
+ else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD;
+ else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE;
+ else if (cdmaDbm >= -100) levelDbm = SIGNAL_STRENGTH_POOR;
+ else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+
+ // Ec/Io are in dB*10
+ if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT;
+ else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD;
+ else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE;
+ else if (cdmaEcio >= -150) levelEcio = SIGNAL_STRENGTH_POOR;
+ else levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+
+ int level = (levelDbm < levelEcio) ? levelDbm : levelEcio;
+ if (DBG) log("getCdmaLevel=" + level);
+ return level;
+ }
+
+ /**
+ * Get Evdo as level 0..4
+ *
+ * @hide
+ */
+ public int getEvdoLevel() {
+ int evdoDbm = getEvdoDbm();
+ int evdoSnr = getEvdoSnr();
+ int levelEvdoDbm;
+ int levelEvdoSnr;
+
+ if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT;
+ else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD;
+ else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE;
+ else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR;
+ else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+
+ if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT;
+ else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD;
+ else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE;
+ else if (evdoSnr >= 1) levelEvdoSnr = SIGNAL_STRENGTH_POOR;
+ else levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+
+ int level = (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
+ if (DBG) log("getEvdoLevel=" + level);
+ return level;
+ }
+
+ /**
+ * Get as dBm
+ *
+ * @hide
+ */
+ @Override
+ public int getDbm() {
+ int cdmaDbm = getCdmaDbm();
+ int evdoDbm = getEvdoDbm();
+
+ // Use the lower value to be conservative
+ return (cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm;
+ }
+
+ /**
+ * Get the CDMA RSSI value in dBm
+ */
+ public int getCdmaDbm() {
+ return mCdmaDbm;
+ }
+ /** @hide */
+ public void setCdmaDbm(int cdmaDbm) {
+ mCdmaDbm = cdmaDbm;
+ }
+
+ /**
+ * Get the CDMA Ec/Io value in dB*10
+ */
+ public int getCdmaEcio() {
+ return mCdmaEcio;
+ }
+ /** @hide */
+ public void setCdmaEcio(int cdmaEcio) {
+ mCdmaEcio = cdmaEcio;
+ }
+
+ /**
+ * Get the EVDO RSSI value in dBm
+ */
+ public int getEvdoDbm() {
+ return mEvdoDbm;
+ }
+ /** @hide */
+ public void setEvdoDbm(int evdoDbm) {
+ mEvdoDbm = evdoDbm;
+ }
+
+ /**
+ * Get the EVDO Ec/Io value in dB*10
+ */
+ public int getEvdoEcio() {
+ return mEvdoEcio;
+ }
+ /** @hide */
+ public void setEvdoEcio(int evdoEcio) {
+ mEvdoEcio = evdoEcio;
+ }
+
+ /**
+ * Get the signal to noise ratio. Valid values are 0-8. 8 is the highest.
+ */
+ public int getEvdoSnr() {
+ return mEvdoSnr;
+ }
+ /** @hide */
+ public void setEvdoSnr(int evdoSnr) {
+ mEvdoSnr = evdoSnr;
+ }
+
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return ((mCdmaDbm * primeNum) + (mCdmaEcio * primeNum)
+ + (mEvdoDbm * primeNum) + (mEvdoEcio * primeNum) + (mEvdoSnr * primeNum));
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ CellSignalStrengthCdma s;
+
+ try {
+ s = (CellSignalStrengthCdma) o;
+ } catch (ClassCastException ex) {
+ return false;
+ }
+
+ if (o == null) {
+ return false;
+ }
+
+ return mCdmaDbm == s.mCdmaDbm
+ && mCdmaEcio == s.mCdmaEcio
+ && mEvdoDbm == s.mEvdoDbm
+ && mEvdoEcio == s.mEvdoEcio
+ && mEvdoSnr == s.mEvdoSnr;
+ }
+
+ /**
+ * @return string representation.
+ */
+ @Override
+ public String toString() {
+ return "CellSignalStrengthCdma:"
+ + " cdmaDbm=" + mCdmaDbm
+ + " cdmaEcio=" + mCdmaEcio
+ + " evdoDbm=" + mEvdoDbm
+ + " evdoEcio=" + mEvdoEcio
+ + " evdoSnr=" + mEvdoSnr;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(CellSignalStrength.TYPE_CDMA);
+ dest.writeInt(mCdmaDbm);
+ dest.writeInt(mCdmaEcio);
+ dest.writeInt(mEvdoDbm);
+ dest.writeInt(mEvdoEcio);
+ dest.writeInt(mEvdoSnr);
+ }
+
+ /**
+ * Construct a SignalStrength object from the given parcel
+ * where the TYPE_LTE token is already been processed.
+ */
+ private CellSignalStrengthCdma(Parcel in) {
+ mCdmaDbm = in.readInt();
+ mCdmaEcio = in.readInt();
+ mEvdoDbm = in.readInt();
+ mEvdoEcio = in.readInt();
+ mEvdoSnr = in.readInt();
+ if (DBG) log("CellSignalStrengthCdma(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @SuppressWarnings("hiding")
+ public static final Parcelable.Creator<CellSignalStrengthCdma> CREATOR =
+ new Parcelable.Creator<CellSignalStrengthCdma>() {
+ @Override
+ public CellSignalStrengthCdma createFromParcel(Parcel in) {
+ if (in.readInt() != CellSignalStrength.TYPE_CDMA) {
+ throw new RuntimeException("Expecting TYPE_CDMA");
+ }
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellSignalStrengthCdma[] newArray(int size) {
+ return new CellSignalStrengthCdma[size];
+ }
+ };
+
+ /** @hide */
+ public static CellSignalStrengthCdma createFromParcelBody(Parcel in) {
+ return new CellSignalStrengthCdma(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java
new file mode 100644
index 000000000000..70876fb44482
--- /dev/null
+++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * LTE signal strength related information.
+ *
+ * @hide
+ */
+public class CellSignalStrengthGsm extends CellSignalStrength implements Parcelable {
+
+ private static final String LOG_TAG = "CellSignalStrengthGsm";
+ private static final boolean DBG = false;
+
+ private static final int GSM_SIGNAL_STRENGTH_GREAT = 12;
+ private static final int GSM_SIGNAL_STRENGTH_GOOD = 8;
+ private static final int GSM_SIGNAL_STRENGTH_MODERATE = 8;
+
+ private int mSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5
+ private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5
+
+ /**
+ * Empty constructor
+ *
+ * @hide
+ */
+ public CellSignalStrengthGsm() {
+ setDefaultValues();
+ }
+
+ /**
+ * Constructor
+ *
+ * @hide
+ */
+ public CellSignalStrengthGsm(int ss, int ber) {
+ initialize(ss, ber);
+ }
+
+ /**
+ * Copy constructors
+ *
+ * @param s Source SignalStrength
+ *
+ * @hide
+ */
+ public CellSignalStrengthGsm(CellSignalStrengthGsm s) {
+ copyFrom(s);
+ }
+
+ /**
+ * Initialize all the values
+ *
+ * @param SignalStrength
+ *
+ * @hide
+ */
+ public void initialize(int ss, int ber) {
+ mSignalStrength = ss;
+ mBitErrorRate = ber;
+ }
+
+ /**
+ * @hide
+ */
+ protected void copyFrom(CellSignalStrengthGsm s) {
+ mSignalStrength = s.mSignalStrength;
+ mBitErrorRate = s.mBitErrorRate;
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public CellSignalStrengthGsm copy() {
+ return new CellSignalStrengthGsm(this);
+ }
+
+ /** @hide */
+ @Override
+ public void setDefaultValues() {
+ mSignalStrength = Integer.MAX_VALUE;
+ mBitErrorRate = Integer.MAX_VALUE;
+ }
+
+ /**
+ * Get LTE as level 0..4
+ *
+ * @hide
+ */
+ @Override
+ public int getLevel() {
+ int level;
+
+ // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
+ // asu = 0 (-113dB or less) is very weak
+ // signal, its better to show 0 bars to the user in such cases.
+ // asu = 99 is a special case, where the signal strength is unknown.
+ int asu = mSignalStrength;
+ if (asu <= 2 || asu == 99) level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+ else if (asu >= GSM_SIGNAL_STRENGTH_GREAT) level = SIGNAL_STRENGTH_GREAT;
+ else if (asu >= GSM_SIGNAL_STRENGTH_GOOD) level = SIGNAL_STRENGTH_GOOD;
+ else if (asu >= GSM_SIGNAL_STRENGTH_MODERATE) level = SIGNAL_STRENGTH_MODERATE;
+ else level = SIGNAL_STRENGTH_POOR;
+ if (DBG) log("getLevel=" + level);
+ return level;
+ }
+
+ /**
+ * Get LTE as dBm
+ *
+ * @hide
+ */
+ @Override
+ public int getDbm() {
+ int dBm;
+
+ int level = mSignalStrength;
+ int asu = (level == 99 ? Integer.MAX_VALUE : level);
+ if (asu != Integer.MAX_VALUE) {
+ dBm = -113 + (2 * asu);
+ } else {
+ dBm = Integer.MAX_VALUE;
+ }
+ if (DBG) log("getDbm=" + dBm);
+ return dBm;
+ }
+
+ /**
+ * Get the LTE signal level as an asu value between 0..97, 99 is unknown
+ * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
+ *
+ * @hide
+ */
+ @Override
+ public int getAsuLevel() {
+ // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
+ // asu = 0 (-113dB or less) is very weak
+ // signal, its better to show 0 bars to the user in such cases.
+ // asu = 99 is a special case, where the signal strength is unknown.
+ int level = mSignalStrength;
+ if (DBG) log("getAsuLevel=" + level);
+ return level;
+ }
+
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return (mSignalStrength * primeNum) + (mBitErrorRate * primeNum);
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ CellSignalStrengthGsm s;
+
+ try {
+ s = (CellSignalStrengthGsm) o;
+ } catch (ClassCastException ex) {
+ return false;
+ }
+
+ if (o == null) {
+ return false;
+ }
+
+ return mSignalStrength == s.mSignalStrength && mBitErrorRate == s.mBitErrorRate;
+ }
+
+ /**
+ * @return string representation.
+ */
+ @Override
+ public String toString() {
+ return "CellSignalStrengthGsm:"
+ + " ss=" + mSignalStrength
+ + " ber=" + mBitErrorRate;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(CellSignalStrength.TYPE_GSM);
+ dest.writeInt(mSignalStrength);
+ dest.writeInt(mBitErrorRate);
+ }
+
+ /**
+ * Construct a SignalStrength object from the given parcel
+ * where the token is already been processed.
+ */
+ private CellSignalStrengthGsm(Parcel in) {
+ mSignalStrength = in.readInt();
+ mBitErrorRate = in.readInt();
+ if (DBG) log("CellSignalStrengthGsm(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @SuppressWarnings("hiding")
+ public static final Parcelable.Creator<CellSignalStrengthGsm> CREATOR =
+ new Parcelable.Creator<CellSignalStrengthGsm>() {
+ @Override
+ public CellSignalStrengthGsm createFromParcel(Parcel in) {
+ if (in.readInt() != CellSignalStrength.TYPE_GSM) {
+ throw new RuntimeException("Expecting TYPE_GSM");
+ }
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellSignalStrengthGsm[] newArray(int size) {
+ return new CellSignalStrengthGsm[size];
+ }
+ };
+
+ /** @hide */
+ public static CellSignalStrengthGsm createFromParcelBody(Parcel in) {
+ return new CellSignalStrengthGsm(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java
new file mode 100644
index 000000000000..3caea3db9fbd
--- /dev/null
+++ b/telephony/java/android/telephony/CellSignalStrengthLte.java
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+/**
+ * LTE signal strength related information.
+ *
+ * @hide
+ */
+public class CellSignalStrengthLte extends CellSignalStrength implements Parcelable {
+
+ private static final String LOG_TAG = "CellSignalStrengthLte";
+ private static final boolean DBG = false;
+
+ private int mSignalStrength;
+ private int mRsrp;
+ private int mRsrq;
+ private int mRssnr;
+ private int mCqi;
+ private int mTimingAdvance;
+
+ /**
+ * Empty constructor
+ *
+ * @hide
+ */
+ public CellSignalStrengthLte() {
+ setDefaultValues();
+ }
+
+ /**
+ * Constructor
+ *
+ * @hide
+ */
+ public CellSignalStrengthLte(int signalStrength, int rsrp, int rsrq, int rssnr, int cqi,
+ int timingAdvance) {
+ initialize(signalStrength, rsrp, rsrq, rssnr, cqi, timingAdvance);
+ }
+
+ /**
+ * Copy constructors
+ *
+ * @param s Source SignalStrength
+ *
+ * @hide
+ */
+ public CellSignalStrengthLte(CellSignalStrengthLte s) {
+ copyFrom(s);
+ }
+
+ /**
+ * Initialize all the values
+ *
+ * @param lteSignalStrength
+ * @param rsrp
+ * @param rsrq
+ * @param rssnr
+ * @param cqi
+ *
+ * @hide
+ */
+ public void initialize(int lteSignalStrength, int rsrp, int rsrq, int rssnr, int cqi,
+ int timingAdvance) {
+ mSignalStrength = lteSignalStrength;
+ mRsrp = rsrp;
+ mRsrq = rsrq;
+ mRssnr = rssnr;
+ mCqi = cqi;
+ mTimingAdvance = timingAdvance;
+ }
+
+ /**
+ * @hide
+ */
+ protected void copyFrom(CellSignalStrengthLte s) {
+ mSignalStrength = s.mSignalStrength;
+ mRsrp = s.mRsrp;
+ mRsrq = s.mRsrq;
+ mRssnr = s.mRssnr;
+ mCqi = s.mCqi;
+ mTimingAdvance = s.mTimingAdvance;
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public CellSignalStrengthLte copy() {
+ return new CellSignalStrengthLte(this);
+ }
+
+ /** @hide */
+ @Override
+ public void setDefaultValues() {
+ mSignalStrength = Integer.MAX_VALUE;
+ mRsrp = Integer.MAX_VALUE;
+ mRsrq = Integer.MAX_VALUE;
+ mRssnr = Integer.MAX_VALUE;
+ mCqi = Integer.MAX_VALUE;
+ mTimingAdvance = Integer.MAX_VALUE;
+ }
+
+ /**
+ * Get LTE as level 0..4
+ *
+ * @hide
+ */
+ @Override
+ public int getLevel() {
+ int levelRsrp = 0;
+ int levelRssnr = 0;
+
+ if (mRsrp == Integer.MAX_VALUE) levelRsrp = 0;
+ else if (mRsrp >= -95) levelRsrp = SIGNAL_STRENGTH_GREAT;
+ else if (mRsrp >= -105) levelRsrp = SIGNAL_STRENGTH_GOOD;
+ else if (mRsrp >= -115) levelRsrp = SIGNAL_STRENGTH_MODERATE;
+ else levelRsrp = SIGNAL_STRENGTH_POOR;
+
+ // See RIL_LTE_SignalStrength in ril.h
+ if (mRssnr == Integer.MAX_VALUE) levelRssnr = 0;
+ else if (mRssnr >= 45) levelRssnr = SIGNAL_STRENGTH_GREAT;
+ else if (mRssnr >= 10) levelRssnr = SIGNAL_STRENGTH_GOOD;
+ else if (mRssnr >= -30) levelRssnr = SIGNAL_STRENGTH_MODERATE;
+ else levelRssnr = SIGNAL_STRENGTH_POOR;
+
+ int level;
+ if (mRsrp == Integer.MAX_VALUE)
+ level = levelRssnr;
+ else if (mRssnr == Integer.MAX_VALUE)
+ level = levelRsrp;
+ else
+ level = (levelRssnr < levelRsrp) ? levelRssnr : levelRsrp;
+
+ if (DBG) log("Lte rsrp level: " + levelRsrp
+ + " snr level: " + levelRssnr + " level: " + level);
+ return level;
+ }
+
+ /**
+ * Get LTE as dBm
+ *
+ * @hide
+ */
+ @Override
+ public int getDbm() {
+ return mRsrp;
+ }
+
+ /**
+ * Get the LTE signal level as an asu value between 0..97, 99 is unknown
+ * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
+ *
+ * @hide
+ */
+ @Override
+ public int getAsuLevel() {
+ int lteAsuLevel = 99;
+ int lteDbm = getDbm();
+ if (lteDbm <= -140) lteAsuLevel = 0;
+ else if (lteDbm >= -43) lteAsuLevel = 97;
+ else lteAsuLevel = lteDbm + 140;
+ if (DBG) log("Lte Asu level: "+lteAsuLevel);
+ return lteAsuLevel;
+ }
+
+ /**
+ * Get the timing advance value for LTE.
+ * See 3GPP xxxx
+ */
+ public int getTimingAdvance() {
+ return mTimingAdvance;
+ }
+
+ @Override
+ public int hashCode() {
+ int primeNum = 31;
+ return (mSignalStrength * primeNum) + (mRsrp * primeNum)
+ + (mRsrq * primeNum) + (mRssnr * primeNum) + (mCqi * primeNum)
+ + (mTimingAdvance * primeNum);
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ CellSignalStrengthLte s;
+
+ try {
+ s = (CellSignalStrengthLte) o;
+ } catch (ClassCastException ex) {
+ return false;
+ }
+
+ if (o == null) {
+ return false;
+ }
+
+ return mSignalStrength == s.mSignalStrength
+ && mRsrp == s.mRsrp
+ && mRsrq == s.mRsrq
+ && mRssnr == s.mRssnr
+ && mCqi == s.mCqi
+ && mTimingAdvance == s.mTimingAdvance;
+ }
+
+ /**
+ * @return string representation.
+ */
+ @Override
+ public String toString() {
+ return "CellSignalStrengthLte:"
+ + " ss=" + mSignalStrength
+ + " rsrp=" + mRsrp
+ + " rsrq=" + mRsrq
+ + " rssnr=" + mRssnr
+ + " cqi=" + mCqi
+ + " ta=" + mTimingAdvance;
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ if (DBG) log("writeToParcel(Parcel, int): " + toString());
+ dest.writeInt(CellSignalStrength.TYPE_LTE);
+ dest.writeInt(mSignalStrength);
+ dest.writeInt(mRsrp);
+ dest.writeInt(mRsrq);
+ dest.writeInt(mRssnr);
+ dest.writeInt(mCqi);
+ dest.writeInt(mTimingAdvance);
+ }
+
+ /**
+ * Construct a SignalStrength object from the given parcel
+ * where the token is already been processed.
+ */
+ private CellSignalStrengthLte(Parcel in) {
+ mSignalStrength = in.readInt();
+ mRsrp = in.readInt();
+ mRsrq = in.readInt();
+ mRssnr = in.readInt();
+ mCqi = in.readInt();
+ mTimingAdvance = in.readInt();
+ if (DBG) log("CellSignalStrengthLte(Parcel): " + toString());
+ }
+
+ /** Implement the Parcelable interface */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface */
+ @SuppressWarnings("hiding")
+ public static final Parcelable.Creator<CellSignalStrengthLte> CREATOR =
+ new Parcelable.Creator<CellSignalStrengthLte>() {
+ @Override
+ public CellSignalStrengthLte createFromParcel(Parcel in) {
+ if (in.readInt() != CellSignalStrength.TYPE_LTE) {
+ throw new RuntimeException("Expecting TYPE_LTE");
+ }
+ return createFromParcelBody(in);
+ }
+
+ @Override
+ public CellSignalStrengthLte[] newArray(int size) {
+ return new CellSignalStrengthLte[size];
+ }
+ };
+
+ /** @hide */
+ public static CellSignalStrengthLte createFromParcelBody(Parcel in) {
+ return new CellSignalStrengthLte(in);
+ }
+
+ /**
+ * log
+ */
+ private static void log(String s) {
+ Log.w(LOG_TAG, s);
+ }
+}
diff --git a/telephony/java/android/telephony/LteCellIdentity.java b/telephony/java/android/telephony/LteCellIdentity.java
deleted file mode 100644
index 396922e74721..000000000000
--- a/telephony/java/android/telephony/LteCellIdentity.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telephony;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * CellIdentity is to represent a unique LTE cell
- *
- * @hide pending API review
- */
-public final class LteCellIdentity extends CellIdentity implements Parcelable {
-
- // 3-digit Mobile Country Code, 0..999
- private final int mMcc;
- // 2 or 3-digit Mobile Network Code, 0..999
- private final int mMnc;
- // 28-bit cell identity
- private final int mCi;
- // physical cell id 0..503
- private final int mPci;
- // 16-bit tracking area code
- private final int mTac;
-
- /**
- *
- * @param mcc 3-digit Mobile Country Code, 0..999
- * @param mnc 2 or 3-digit Mobile Network Code, 0..999
- * @param ci 28-bit Cell Identity
- * @param pci Physical Cell Id 0..503
- * @param tac 16-bit Tracking Area Code
- * @param attr is comma separated “key=value” attribute pairs.
- */
- public LteCellIdentity (int mcc, int mnc,
- int ci, int pci, int tac, String attr) {
- super(CELLID_TYPE_CDMA, attr);
- mMcc = mcc;
- mMnc = mnc;
- mCi = ci;
- mPci = pci;
- mTac = tac;
- }
-
- private LteCellIdentity(Parcel in) {
- super(in);
- mMcc = in.readInt();
- mMnc = in.readInt();
- mCi = in.readInt();
- mPci = in.readInt();
- mTac = in.readInt();
- }
-
- LteCellIdentity(LteCellIdentity cid) {
- super(cid);
- mMcc = cid.mMcc;
- mMnc = cid.mMnc;
- mCi = cid.mCi;
- mPci = cid.mPci;
- mTac = cid.mTac;
- }
-
- /**
- * @return 3-digit Mobile Country Code, 0..999
- */
- public int getMcc() {
- return mMcc;
- }
-
- /**
- * @return 2 or 3-digit Mobile Network Code, 0..999
- */
- public int getMnc() {
- return mMnc;
- }
-
- /**
- * @return 28-bit Cell Identity
- */
- public int getCi() {
- return mCi;
- }
-
- /**
- * @return Physical Cell Id 0..503
- */
- public int getPci() {
- return mPci;
- }
-
- /**
- * @return 16-bit Tracking Area Code
- */
- public int getTac() {
- return mTac;
- }
-
- /** Implement the Parcelable interface {@hide} */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** Implement the Parcelable interface {@hide} */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags);
- dest.writeInt(mMcc);
- dest.writeInt(mMnc);
- dest.writeInt(mCi);
- dest.writeInt(mPci);
- dest.writeInt(mTac);
- }
-
- /** Implement the Parcelable interface {@hide} */
- public static final Creator<LteCellIdentity> CREATOR =
- new Creator<LteCellIdentity>() {
- @Override
- public LteCellIdentity createFromParcel(Parcel in) {
- return new LteCellIdentity(in);
- }
-
- @Override
- public LteCellIdentity[] newArray(int size) {
- return new LteCellIdentity[size];
- }
- };
-}
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index def6939aef28..63d81e9c1b3d 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -27,6 +27,8 @@ import android.util.Log;
import com.android.internal.telephony.IPhoneStateListener;
+import java.util.List;
+
/**
* A listener class for monitoring changes in specific telephony states
* on the device, including service state, signal strength, message
@@ -160,7 +162,8 @@ public class PhoneStateListener {
* Listen for changes to observed cell info.
*
* @see #onCellInfoChanged
- * @hide pending API review
+ *
+ * @hide
*/
public static final int LISTEN_CELL_INFO = 0x00000400;
@@ -284,17 +287,13 @@ public class PhoneStateListener {
}
/**
- * Callback invoked when a observed cell info gets changed.
+ * Callback invoked when a observed cell info has changed,
+ * or new cells have been added or removed.
+ * @param cellInfo is the list of currently visible cells.
*
- * A notification should be sent when:
- * 1. a cell is newly-observed.
- * 2. a observed cell is not visible.
- * 3. any of the cell info of a observed cell has changed.
- *
- * @hide pending API review
+ * @hide
*/
- public void onCellInfoChanged(CellInfo cellInfo) {
- // default implementation empty
+ public void onCellInfoChanged(List<CellInfo> cellInfo) {
}
/**
@@ -346,8 +345,8 @@ public class PhoneStateListener {
Message.obtain(mHandler, LISTEN_OTASP_CHANGED, otaspMode, 0).sendToTarget();
}
- public void onCellInfoChanged(CellInfo cellInfo) {
- Message.obtain(mHandler, LISTEN_CELL_INFO, 0, 0).sendToTarget();
+ public void onCellInfoChanged(List<CellInfo> cellInfo) {
+ Message.obtain(mHandler, LISTEN_CELL_INFO, 0, 0, cellInfo).sendToTarget();
}
};
@@ -387,7 +386,7 @@ public class PhoneStateListener {
PhoneStateListener.this.onOtaspChanged(msg.arg1);
break;
case LISTEN_CELL_INFO:
- PhoneStateListener.this.onCellInfoChanged((CellInfo)msg.obj);
+ PhoneStateListener.this.onCellInfoChanged((List<CellInfo>)msg.obj);
}
}
};
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
index 104966932ebe..d80425c55417 100644
--- a/telephony/java/android/telephony/SignalStrength.java
+++ b/telephony/java/android/telephony/SignalStrength.java
@@ -1,6 +1,5 @@
/*
- * Copyright (C) 2009 Qualcomm Innovation Center, Inc. All Rights Reserved.
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2012 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.
@@ -28,7 +27,7 @@ import android.util.Log;
public class SignalStrength implements Parcelable {
private static final String LOG_TAG = "SignalStrength";
- private static final boolean DBG = false;
+ private static final boolean DBG = true;
/** @hide */
public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
@@ -114,19 +113,9 @@ public class SignalStrength implements Parcelable {
int evdoDbm, int evdoEcio, int evdoSnr,
int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi,
boolean gsm) {
- mGsmSignalStrength = gsmSignalStrength;
- mGsmBitErrorRate = gsmBitErrorRate;
- mCdmaDbm = cdmaDbm;
- mCdmaEcio = cdmaEcio;
- mEvdoDbm = evdoDbm;
- mEvdoEcio = evdoEcio;
- mEvdoSnr = evdoSnr;
- mLteSignalStrength = lteSignalStrength;
- mLteRsrp = lteRsrp;
- mLteRsrq = lteRsrq;
- mLteRssnr = lteRssnr;
- mLteCqi = lteCqi;
- isGsm = gsm;
+ initialize(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
+ evdoDbm, evdoEcio, evdoSnr, lteSignalStrength, lteRsrp,
+ lteRsrq, lteRssnr, lteCqi, gsm);
}
/**
@@ -138,7 +127,7 @@ public class SignalStrength implements Parcelable {
int cdmaDbm, int cdmaEcio,
int evdoDbm, int evdoEcio, int evdoSnr,
boolean gsm) {
- this(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
+ initialize(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
evdoDbm, evdoEcio, evdoSnr, -1, -1,
-1, INVALID_SNR, -1, gsm);
}
@@ -155,6 +144,69 @@ public class SignalStrength implements Parcelable {
}
/**
+ * Initialize gsm/cdma values, sets lte values to defaults.
+ *
+ * @param gsmSignalStrength
+ * @param gsmBitErrorRate
+ * @param cdmaDbm
+ * @param cdmaEcio
+ * @param evdoDbm
+ * @param evdoEcio
+ * @param evdoSnr
+ * @param gsm
+ *
+ * @hide
+ */
+ public void initialize(int gsmSignalStrength, int gsmBitErrorRate,
+ int cdmaDbm, int cdmaEcio,
+ int evdoDbm, int evdoEcio, int evdoSnr,
+ boolean gsm) {
+ initialize(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio,
+ evdoDbm, evdoEcio, evdoSnr, -1, -1,
+ -1, INVALID_SNR, -1, gsm);
+ }
+
+ /**
+ * Initialize all the values
+ *
+ * @param gsmSignalStrength
+ * @param gsmBitErrorRate
+ * @param cdmaDbm
+ * @param cdmaEcio
+ * @param evdoDbm
+ * @param evdoEcio
+ * @param evdoSnr
+ * @param lteSignalStrength
+ * @param lteRsrp
+ * @param lteRsrq
+ * @param lteRssnr
+ * @param lteCqi
+ * @param gsm
+ *
+ * @hide
+ */
+ public void initialize(int gsmSignalStrength, int gsmBitErrorRate,
+ int cdmaDbm, int cdmaEcio,
+ int evdoDbm, int evdoEcio, int evdoSnr,
+ int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi,
+ boolean gsm) {
+ mGsmSignalStrength = gsmSignalStrength;
+ mGsmBitErrorRate = gsmBitErrorRate;
+ mCdmaDbm = cdmaDbm;
+ mCdmaEcio = cdmaEcio;
+ mEvdoDbm = evdoDbm;
+ mEvdoEcio = evdoEcio;
+ mEvdoSnr = evdoSnr;
+ mLteSignalStrength = lteSignalStrength;
+ mLteRsrp = lteRsrp;
+ mLteRsrq = lteRsrq;
+ mLteRssnr = lteRssnr;
+ mLteCqi = lteCqi;
+ isGsm = gsm;
+ if (DBG) log("initialize: " + toString());
+ }
+
+ /**
* @hide
*/
protected void copyFrom(SignalStrength s) {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index fa4b7cdc16ab..2b0fcd8e336e 100755
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1272,7 +1272,7 @@ public class TelephonyManager {
* <p>Requires Permission:
* (@link android.Manifest.permission#ACCESS_COARSE_UPDATES}
*
- * @hide pending API review
+ * @hide
*/
public List<CellInfo> getAllCellInfo() {
try {
diff --git a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
index f94efd8f56d7..010ad2b0a2c8 100644
--- a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
+++ b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java
@@ -81,8 +81,8 @@ public class CdmaSmsCbProgramData implements Parcelable {
/** Service category to modify. */
private final int mCategory;
- /** Language used for service category name (ISO 639 two character code). */
- private final String mLanguage;
+ /** Language used for service category name (defined in BearerData.LANGUAGE_*). */
+ private final int mLanguage;
/** Maximum number of messages to store for this service category. */
private final int mMaxMessages;
@@ -94,7 +94,7 @@ public class CdmaSmsCbProgramData implements Parcelable {
private final String mCategoryName;
/** Create a new CdmaSmsCbProgramData object with the specified values. */
- public CdmaSmsCbProgramData(int operation, int category, String language, int maxMessages,
+ public CdmaSmsCbProgramData(int operation, int category, int language, int maxMessages,
int alertOption, String categoryName) {
mOperation = operation;
mCategory = category;
@@ -108,7 +108,7 @@ public class CdmaSmsCbProgramData implements Parcelable {
CdmaSmsCbProgramData(Parcel in) {
mOperation = in.readInt();
mCategory = in.readInt();
- mLanguage = in.readString();
+ mLanguage = in.readInt();
mMaxMessages = in.readInt();
mAlertOption = in.readInt();
mCategoryName = in.readString();
@@ -124,7 +124,7 @@ public class CdmaSmsCbProgramData implements Parcelable {
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mOperation);
dest.writeInt(mCategory);
- dest.writeString(mLanguage);
+ dest.writeInt(mLanguage);
dest.writeInt(mMaxMessages);
dest.writeInt(mAlertOption);
dest.writeString(mCategoryName);
@@ -147,10 +147,10 @@ public class CdmaSmsCbProgramData implements Parcelable {
}
/**
- * Returns the ISO-639-1 language code for the service category name, or null if not present.
- * @return a two-digit ISO-639-1 language code, e.g. "en" for English
+ * Returns the CDMA language code for this service category.
+ * @return one of the language values defined in BearerData.LANGUAGE_*
*/
- public String getLanguageCode() {
+ public int getLanguage() {
return mLanguage;
}
@@ -171,7 +171,7 @@ public class CdmaSmsCbProgramData implements Parcelable {
}
/**
- * Returns the service category name, in the language specified by {@link #getLanguageCode()}.
+ * Returns the service category name, in the language specified by {@link #getLanguage()}.
* @return an optional service category name
*/
public String getCategoryName() {
diff --git a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramResults.java b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramResults.java
new file mode 100644
index 000000000000..68bfa3ce9016
--- /dev/null
+++ b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramResults.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.cdma;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * CDMA Service Category Program Results from SCPT teleservice SMS.
+ *
+ * {@hide}
+ */
+public class CdmaSmsCbProgramResults implements Parcelable {
+
+ /** Program result: success. */
+ public static final int RESULT_SUCCESS = 0;
+
+ /** Program result: memory limit exceeded. */
+ public static final int RESULT_MEMORY_LIMIT_EXCEEDED = 1;
+
+ /** Program result: limit exceeded. */
+ public static final int RESULT_CATEGORY_LIMIT_EXCEEDED = 2;
+
+ /** Program result: category already opted in. */
+ public static final int RESULT_CATEGORY_ALREADY_ADDED = 3;
+
+ /** Program result: category already opted in. */
+ public static final int RESULT_CATEGORY_ALREADY_DELETED = 4;
+
+ /** Program result: invalid MAX_MESSAGES. */
+ public static final int RESULT_INVALID_MAX_MESSAGES = 5;
+
+ /** Program result: invalid ALERT_OPTION. */
+ public static final int RESULT_INVALID_ALERT_OPTION = 6;
+
+ /** Program result: invalid service category name. */
+ public static final int RESULT_INVALID_CATEGORY_NAME = 7;
+
+ /** Program result: unspecified programming failure. */
+ public static final int RESULT_UNSPECIFIED_FAILURE = 8;
+
+ /** Service category to modify. */
+ private final int mCategory;
+
+ /** Language used for service category name (defined in BearerData.LANGUAGE_*). */
+ private final int mLanguage;
+
+ /** Result of service category programming for this category. */
+ private final int mCategoryResult;
+
+ /** Create a new CdmaSmsCbProgramResults object with the specified values. */
+ public CdmaSmsCbProgramResults(int category, int language, int categoryResult) {
+ mCategory = category;
+ mLanguage = language;
+ mCategoryResult = categoryResult;
+ }
+
+ /** Create a new CdmaSmsCbProgramResults object from a Parcel. */
+ CdmaSmsCbProgramResults(Parcel in) {
+ mCategory = in.readInt();
+ mLanguage = in.readInt();
+ mCategoryResult = in.readInt();
+ }
+
+ /**
+ * Flatten this object into a Parcel.
+ *
+ * @param dest The Parcel in which the object should be written.
+ * @param flags Additional flags about how the object should be written (ignored).
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mCategory);
+ dest.writeInt(mLanguage);
+ dest.writeInt(mCategoryResult);
+ }
+
+ /**
+ * Returns the CDMA service category to modify.
+ * @return a 16-bit CDMA service category value
+ */
+ public int getCategory() {
+ return mCategory;
+ }
+
+ /**
+ * Returns the CDMA language code for this service category.
+ * @return one of the language values defined in BearerData.LANGUAGE_*
+ */
+ public int getLanguage() {
+ return mLanguage;
+ }
+
+ /**
+ * Returns the result of service programming for this category
+ * @return the result of service programming for this category
+ */
+ public int getCategoryResult() {
+ return mCategoryResult;
+ }
+
+ @Override
+ public String toString() {
+ return "CdmaSmsCbProgramResults{category=" + mCategory
+ + ", language=" + mLanguage + ", result=" + mCategoryResult + '}';
+ }
+
+ /**
+ * Describe the kinds of special objects contained in the marshalled representation.
+ * @return a bitmask indicating this Parcelable contains no special objects
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Creator for unparcelling objects. */
+ public static final Parcelable.Creator<CdmaSmsCbProgramResults>
+ CREATOR = new Parcelable.Creator<CdmaSmsCbProgramResults>() {
+ @Override
+ public CdmaSmsCbProgramResults createFromParcel(Parcel in) {
+ return new CdmaSmsCbProgramResults(in);
+ }
+
+ @Override
+ public CdmaSmsCbProgramResults[] newArray(int size) {
+ return new CdmaSmsCbProgramResults[size];
+ }
+ };
+}
diff --git a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl
index d6a1edd3d25f..3a04ceb9e65b 100644
--- a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl
+++ b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl
@@ -34,6 +34,6 @@ oneway interface IPhoneStateListener {
void onDataActivity(int direction);
void onSignalStrengthsChanged(in SignalStrength signalStrength);
void onOtaspChanged(in int otaspMode);
- void onCellInfoChanged(in CellInfo cellInfo);
+ void onCellInfoChanged(in List<CellInfo> cellInfo);
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index 3c9a99b9bbb6..59c84724e233 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -40,5 +40,5 @@ interface ITelephonyRegistry {
void notifyDataConnectionFailed(String reason, String apnType);
void notifyCellLocation(in Bundle cellLocation);
void notifyOtaspChanged(in int otaspMode);
- void notifyCellInfo(in CellInfo cellInfo);
+ void notifyCellInfo(in List<CellInfo> cellInfo);
}
diff --git a/test-runner/src/android/test/MoreAsserts.java b/test-runner/src/android/test/MoreAsserts.java
index 9e0d018b0afb..83cc420f66ea 100644
--- a/test-runner/src/android/test/MoreAsserts.java
+++ b/test-runner/src/android/test/MoreAsserts.java
@@ -158,7 +158,7 @@ public final class MoreAsserts {
* Asserts that array {@code actual} is the same size and every element
* is the same as those in array {@code expected}. Note that this uses
* {@code equals()} instead of {@code ==} to compare the objects.
- * {@code null} will be considered equal to {code null} (unlike SQL).
+ * {@code null} will be considered equal to {@code null} (unlike SQL).
* On failure, message indicates first specific element mismatch.
*/
public static void assertEquals(
diff --git a/test-runner/src/android/test/ProviderTestCase2.java b/test-runner/src/android/test/ProviderTestCase2.java
index 2811b0d4cf5d..f7c4e03db7fd 100644
--- a/test-runner/src/android/test/ProviderTestCase2.java
+++ b/test-runner/src/android/test/ProviderTestCase2.java
@@ -64,7 +64,7 @@ import java.io.File;
* {@link #ProviderTestCase2(Class, String)} as its first operation.
* </p>
* For more information on content provider testing, please see
- * <a href="{@docRoot}guide/topics/testing/provider_testing.html">Content Provider Testing</a>.
+ * <a href="{@docRoot}tools/testing/contentprovider_testing.html">Content Provider Testing</a>.
*/
public abstract class ProviderTestCase2<T extends ContentProvider> extends AndroidTestCase {
diff --git a/test-runner/src/android/test/ServiceTestCase.java b/test-runner/src/android/test/ServiceTestCase.java
index 06c1c5b31f4b..eaace2799de9 100644
--- a/test-runner/src/android/test/ServiceTestCase.java
+++ b/test-runner/src/android/test/ServiceTestCase.java
@@ -91,7 +91,7 @@ import java.util.Random;
* {@link #setApplication setApplication()}. You must do this <em>before</em> calling
* startService() or bindService(). The test framework provides a
* number of alternatives for Context, including
- * {link android.test.mock.MockContext MockContext},
+ * {@link android.test.mock.MockContext MockContext},
* {@link android.test.RenamingDelegatingContext RenamingDelegatingContext},
* {@link android.content.ContextWrapper ContextWrapper}, and
* {@link android.test.IsolatedContext}.
diff --git a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
index 919e2b332da4..4ec86b186285 100644
--- a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
+++ b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java
@@ -69,7 +69,7 @@ public class DataIdleTest extends InstrumentationTestCase {
/**
* Helper method that fetches all the network stats available and reports it
* to instrumentation out.
- * @param template {link {@link NetworkTemplate} to match.
+ * @param template {@link NetworkTemplate} to match.
*/
private void fetchStats(NetworkTemplate template) {
INetworkStatsSession session = null;
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java
new file mode 100644
index 000000000000..bf68f919f035
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2012 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.rs.image;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Sampler;
+import android.renderscript.Type;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+public class Fisheye extends TestBase {
+ private ScriptC_fisheye_full mScript_full = null;
+ private ScriptC_fisheye_relaxed mScript_relaxed = null;
+ private final boolean relaxed;
+ private float center_x = 0.5f;
+ private float center_y = 0.5f;
+ private float scale = 0.5f;
+
+ public Fisheye(boolean relaxed) {
+ this.relaxed = relaxed;
+ }
+
+ public boolean onBar1Setup(SeekBar b, TextView t) {
+ t.setText("Scale");
+ b.setMax(100);
+ b.setProgress(25);
+ return true;
+ }
+ public boolean onBar2Setup(SeekBar b, TextView t) {
+ t.setText("Shift center X");
+ b.setMax(100);
+ b.setProgress(50);
+ return true;
+ }
+ public boolean onBar3Setup(SeekBar b, TextView t) {
+ t.setText("Shift center Y");
+ b.setMax(100);
+ b.setProgress(50);
+ return true;
+ }
+
+ public void onBar1Changed(int progress) {
+ scale = progress / 50.0f;
+ do_init();
+ }
+ public void onBar2Changed(int progress) {
+ center_x = progress / 100.0f;
+ do_init();
+ }
+ public void onBar3Changed(int progress) {
+ center_y = progress / 100.0f;
+ do_init();
+ }
+
+ private void do_init() {
+ if (relaxed)
+ mScript_relaxed.invoke_init_filter(
+ mInPixelsAllocation.getType().getX(),
+ mInPixelsAllocation.getType().getY(), center_x, center_y,
+ scale);
+ else
+ mScript_full.invoke_init_filter(
+ mInPixelsAllocation.getType().getX(),
+ mInPixelsAllocation.getType().getY(), center_x, center_y,
+ scale);
+ }
+
+ public void createTest(android.content.res.Resources res) {
+ if (relaxed) {
+ mScript_relaxed = new ScriptC_fisheye_relaxed(mRS, res,
+ R.raw.fisheye_relaxed);
+ mScript_relaxed.set_in_alloc(mInPixelsAllocation);
+ mScript_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
+ } else {
+ mScript_full = new ScriptC_fisheye_full(mRS, res,
+ R.raw.fisheye_full);
+ mScript_full.set_in_alloc(mInPixelsAllocation);
+ mScript_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
+ }
+ do_init();
+ }
+
+ public void runTest() {
+ if (relaxed)
+ mScript_relaxed.forEach_root(mOutPixelsAllocation);
+ else
+ mScript_full.forEach_root(mOutPixelsAllocation);
+ }
+
+}
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
index 3a9838bf790a..9ed8fa93aeba 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
@@ -143,6 +143,18 @@ public class ImageProcessingActivity extends Activity
case 6:
mTest = new Grain();
break;
+ case 7:
+ mTest = new Fisheye(false);
+ break;
+ case 8:
+ mTest = new Fisheye(true);
+ break;
+ case 9:
+ mTest = new Vignette(false);
+ break;
+ case 10:
+ mTest = new Vignette(true);
+ break;
}
mTest.createBaseTest(this, mBitmapIn);
@@ -155,7 +167,7 @@ public class ImageProcessingActivity extends Activity
}
void setupTests() {
- mTestNames = new String[7];
+ mTestNames = new String[11];
mTestNames[0] = "Levels Vec3 Relaxed";
mTestNames[1] = "Levels Vec4 Relaxed";
mTestNames[2] = "Levels Vec3 Full";
@@ -163,6 +175,10 @@ public class ImageProcessingActivity extends Activity
mTestNames[4] = "Blur radius 25";
mTestNames[5] = "Greyscale";
mTestNames[6] = "Grain";
+ mTestNames[7] = "Fisheye Full";
+ mTestNames[8] = "Fisheye Relaxed";
+ mTestNames[9] = "Vignette Full";
+ mTestNames[10] = "Vignette Relaxed";
mTestSpinner.setAdapter(new ArrayAdapter<String>(
this, R.layout.spinner_layout, mTestNames));
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java
new file mode 100644
index 000000000000..927d7d533c14
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2012 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.rs.image;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Sampler;
+import android.renderscript.Type;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+public class Vignette extends TestBase {
+ private ScriptC_vignette_full mScript_full = null;
+ private ScriptC_vignette_relaxed mScript_relaxed = null;
+ private final boolean relaxed;
+ private float center_x = 0.5f;
+ private float center_y = 0.5f;
+ private float scale = 0.5f;
+ private float shade = 0.5f;
+ private float slope = 20.0f;
+
+ public Vignette(boolean relaxed) {
+ this.relaxed = relaxed;
+ }
+
+ public boolean onBar1Setup(SeekBar b, TextView t) {
+ t.setText("Scale");
+ b.setMax(100);
+ b.setProgress(25);
+ return true;
+ }
+ public boolean onBar2Setup(SeekBar b, TextView t) {
+ t.setText("Shade");
+ b.setMax(100);
+ b.setProgress(50);
+ return true;
+ }
+ public boolean onBar3Setup(SeekBar b, TextView t) {
+ t.setText("Slope");
+ b.setMax(100);
+ b.setProgress(20);
+ return true;
+ }
+ public boolean onBar4Setup(SeekBar b, TextView t) {
+ t.setText("Shift center X");
+ b.setMax(100);
+ b.setProgress(50);
+ return true;
+ }
+ public boolean onBar5Setup(SeekBar b, TextView t) {
+ t.setText("Shift center Y");
+ b.setMax(100);
+ b.setProgress(50);
+ return true;
+ }
+
+ public void onBar1Changed(int progress) {
+ scale = progress / 50.0f;
+ do_init();
+ }
+ public void onBar2Changed(int progress) {
+ shade = progress / 100.0f;
+ do_init();
+ }
+ public void onBar3Changed(int progress) {
+ slope = (float)progress;
+ do_init();
+ }
+ public void onBar4Changed(int progress) {
+ center_x = progress / 100.0f;
+ do_init();
+ }
+ public void onBar5Changed(int progress) {
+ center_y = progress / 100.0f;
+ do_init();
+ }
+
+ private void do_init() {
+ if (relaxed)
+ mScript_relaxed.invoke_init_vignette(
+ mInPixelsAllocation.getType().getX(),
+ mInPixelsAllocation.getType().getY(), center_x, center_y,
+ scale, shade, slope);
+ else
+ mScript_full.invoke_init_vignette(
+ mInPixelsAllocation.getType().getX(),
+ mInPixelsAllocation.getType().getY(), center_x, center_y,
+ scale, shade, slope);
+ }
+
+ public void createTest(android.content.res.Resources res) {
+ if (relaxed) {
+ mScript_relaxed = new ScriptC_vignette_relaxed(mRS, res,
+ R.raw.vignette_relaxed);
+ } else {
+ mScript_full = new ScriptC_vignette_full(mRS, res,
+ R.raw.vignette_full);
+ }
+ do_init();
+ }
+
+ public void runTest() {
+ if (relaxed)
+ mScript_relaxed.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
+ else
+ mScript_full.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
+ }
+
+}
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
new file mode 100644
index 000000000000..4dcfc1daaca0
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+rs_allocation in_alloc;
+rs_sampler sampler;
+
+static float2 center, dimensions;
+static float2 scale;
+static float alpha;
+static float radius2;
+static float factor;
+
+void init_filter(uint32_t dim_x, uint32_t dim_y, float focus_x, float focus_y, float k) {
+ center.x = focus_x;
+ center.y = focus_y;
+ dimensions.x = (float)dim_x;
+ dimensions.y = (float)dim_y;
+
+ alpha = k * 2.0 + 0.75;
+ float bound2 = 0.25;
+ if (dim_x > dim_y) {
+ scale.x = 1.0;
+ scale.y = dimensions.y / dimensions.x;
+ bound2 *= (scale.y*scale.y + 1);
+ } else {
+ scale.x = dimensions.x / dimensions.y;
+ scale.y = 1.0;
+ bound2 *= (scale.x*scale.x + 1);
+ }
+ const float bound = sqrt(bound2);
+ const float radius = 1.15 * bound;
+ radius2 = radius*radius;
+ const float max_radian = 0.5f * M_PI - atan(alpha / bound * sqrt(radius2 - bound2));
+ factor = bound / max_radian;
+}
+
+void root(uchar4 *out, uint32_t x, uint32_t y) {
+ // Convert x and y to floating point coordinates with center as origin
+ float2 coord;
+ coord.x = (float)x / dimensions.x;
+ coord.y = (float)y / dimensions.y;
+ coord -= center;
+ const float dist = length(scale * coord);
+ const float radian = M_PI_2 - atan((alpha * sqrt(radius2 - dist * dist)) / dist);
+ const float scalar = radian * factor / dist;
+ const float2 new_coord = coord * scalar + center;
+ const float4 fout = rsSample(in_alloc, sampler, new_coord);
+ *out = rsPackColorTo8888(fout);
+}
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs
new file mode 100644
index 000000000000..20f27e25765a
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(com.android.rs.image)
+
+#include "fisheye.rsh"
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs
new file mode 100644
index 000000000000..dc3ffcb83419
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(com.android.rs.image)
+#pragma rs_fp_relaxed
+
+#include "fisheye.rsh"
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
new file mode 100644
index 000000000000..77ead9c915b1
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+static float2 scale;
+static float2 center, dimensions;
+static float range, inv_max_dist, shade, slope;
+
+void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
+ float desired_scale, float desired_shade, float desired_slope) {
+
+ center.x = center_x;
+ center.y = center_y;
+ dimensions.x = (float)dim_x;
+ dimensions.y = (float)dim_y;
+
+ float max_dist = 0.5;
+ if (dim_x > dim_y) {
+ scale.x = 1.0;
+ scale.y = dimensions.y / dimensions.x;
+ max_dist *= sqrt(scale.y*scale.y + 1);
+ } else {
+ scale.x = dimensions.x / dimensions.y;
+ scale.y = 1.0;
+ max_dist *= sqrt(scale.x*scale.x + 1);
+ }
+ inv_max_dist = 1.0/max_dist;
+ // Range needs to be between 1.3 to 0.6. When scale is zero then range is
+ // 1.3 which means no vignette at all because the luminousity difference is
+ // less than 1/256. Expect input scale to be between 0.0 and 1.0.
+ range = 1.3 - 0.7*sqrt(desired_scale);
+ shade = desired_shade;
+ slope = desired_slope;
+}
+
+void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
+ // Convert x and y to floating point coordinates with center as origin
+ const float4 fin = rsUnpackColor8888(*in);
+ float2 coord;
+ coord.x = (float)x / dimensions.x;
+ coord.y = (float)y / dimensions.y;
+ coord -= center;
+ const float dist = length(scale * coord);
+ const float lumen = shade / (1.0 + exp((dist * inv_max_dist - range) * slope)) + (1.0 - shade);
+ float4 fout;
+ fout.rgb = fin.rgb * lumen;
+ fout.w = fin.w;
+ *out = rsPackColorTo8888(fout);
+}
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs
new file mode 100644
index 000000000000..64942d94cb39
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(com.android.rs.image)
+
+#include "vignette.rsh"
+
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs
new file mode 100644
index 000000000000..8e47ea96989e
--- /dev/null
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(com.android.rs.image)
+#pragma rs_fp_relaxed
+
+#include "vignette.rsh"
+
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
index 9d94ba58d7ee..ca49344a6498 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
@@ -299,14 +299,14 @@ public class UT_math_agree extends UnitTest {
float[] rand_f2_1 = randvec_float(2);
float[] rand_f3_1 = randvec_float(3);
float[] rand_f4_1 = randvec_float(4);
- byte rand_sc1_0 = (byte)rand.nextInt(0x1 << 8);
- byte[] rand_sc2_0 = randvec_char(2);
- byte[] rand_sc3_0 = randvec_char(3);
- byte[] rand_sc4_0 = randvec_char(4);
- byte rand_sc1_1 = (byte)rand.nextInt(0x1 << 8);
- byte[] rand_sc2_1 = randvec_char(2);
- byte[] rand_sc3_1 = randvec_char(3);
- byte[] rand_sc4_1 = randvec_char(4);
+ short rand_uc1_0 = (short)rand.nextInt(0x1 << 8);
+ short[] rand_uc2_0 = randvec_uchar(2);
+ short[] rand_uc3_0 = randvec_uchar(3);
+ short[] rand_uc4_0 = randvec_uchar(4);
+ short rand_uc1_1 = (short)rand.nextInt(0x1 << 8);
+ short[] rand_uc2_1 = randvec_uchar(2);
+ short[] rand_uc3_1 = randvec_uchar(3);
+ short[] rand_uc4_1 = randvec_uchar(4);
short rand_ss1_0 = (short)rand.nextInt(0x1 << 16);
short[] rand_ss2_0 = randvec_short(2);
short[] rand_ss3_0 = randvec_short(3);
@@ -315,6 +315,14 @@ public class UT_math_agree extends UnitTest {
short[] rand_ss2_1 = randvec_short(2);
short[] rand_ss3_1 = randvec_short(3);
short[] rand_ss4_1 = randvec_short(4);
+ int rand_us1_0 = rand.nextInt(0x1 << 16);
+ int[] rand_us2_0 = randvec_ushort(2);
+ int[] rand_us3_0 = randvec_ushort(3);
+ int[] rand_us4_0 = randvec_ushort(4);
+ int rand_us1_1 = rand.nextInt(0x1 << 16);
+ int[] rand_us2_1 = randvec_ushort(2);
+ int[] rand_us3_1 = randvec_ushort(3);
+ int[] rand_us4_1 = randvec_ushort(4);
int rand_si1_0 = rand.nextInt();
int[] rand_si2_0 = randvec_int(2);
int[] rand_si3_0 = randvec_int(3);
@@ -323,6 +331,14 @@ public class UT_math_agree extends UnitTest {
int[] rand_si2_1 = randvec_int(2);
int[] rand_si3_1 = randvec_int(3);
int[] rand_si4_1 = randvec_int(4);
+ long rand_ui1_0 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
+ long[] rand_ui2_0 = randvec_uint(2);
+ long[] rand_ui3_0 = randvec_uint(3);
+ long[] rand_ui4_0 = randvec_uint(4);
+ long rand_ui1_1 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
+ long[] rand_ui2_1 = randvec_uint(2);
+ long[] rand_ui3_1 = randvec_uint(3);
+ long[] rand_ui4_1 = randvec_uint(4);
long rand_sl1_0 = rand.nextLong();
long[] rand_sl2_0 = randvec_long(2);
long[] rand_sl3_0 = randvec_long(3);
@@ -331,32 +347,16 @@ public class UT_math_agree extends UnitTest {
long[] rand_sl2_1 = randvec_long(2);
long[] rand_sl3_1 = randvec_long(3);
long[] rand_sl4_1 = randvec_long(4);
- // FIXME: generate unsigned input vectors once bug 6764163 is fixed
+ // FIXME: generate signed char vectors once bug 6865598 is fixed
/*
- short rand_uc1_0 = (short)rand.nextInt(0x1 << 8);
- short[] rand_uc2_0 = randvec_uchar(2);
- short[] rand_uc3_0 = randvec_uchar(3);
- short[] rand_uc4_0 = randvec_uchar(4);
- short rand_uc1_1 = (short)rand.nextInt(0x1 << 8);
- short[] rand_uc2_1 = randvec_uchar(2);
- short[] rand_uc3_1 = randvec_uchar(3);
- short[] rand_uc4_1 = randvec_uchar(4);
- int rand_us1_0 = rand.nextInt(0x1 << 16);
- int[] rand_us2_0 = randvec_ushort(2);
- int[] rand_us3_0 = randvec_ushort(3);
- int[] rand_us4_0 = randvec_ushort(4);
- int rand_us1_1 = rand.nextInt(0x1 << 16);
- int[] rand_us2_1 = randvec_ushort(2);
- int[] rand_us3_1 = randvec_ushort(3);
- int[] rand_us4_1 = randvec_ushort(4);
- long rand_ui1_0 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
- long[] rand_ui2_0 = randvec_uint(2);
- long[] rand_ui3_0 = randvec_uint(3);
- long[] rand_ui4_0 = randvec_uint(4);
- long rand_ui1_1 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
- long[] rand_ui2_1 = randvec_uint(2);
- long[] rand_ui3_1 = randvec_uint(3);
- long[] rand_ui4_1 = randvec_uint(4);
+ byte rand_sc1_0 = (byte)rand.nextInt(0x1 << 8);
+ byte[] rand_sc2_0 = randvec_char(2);
+ byte[] rand_sc3_0 = randvec_char(3);
+ byte[] rand_sc4_0 = randvec_char(4);
+ byte rand_sc1_1 = (byte)rand.nextInt(0x1 << 8);
+ byte[] rand_sc2_1 = randvec_char(2);
+ byte[] rand_sc3_1 = randvec_char(3);
+ byte[] rand_sc4_1 = randvec_char(4);
*/
// TODO: generate unsigned long vectors
@@ -369,10 +369,10 @@ public class UT_math_agree extends UnitTest {
s.set_rand_f2_1(pack_f2(rand_f2_1));
s.set_rand_f3_1(pack_f3(rand_f3_1));
s.set_rand_f4_1(pack_f4(rand_f4_1));
- s.set_rand_sc1_1(rand_sc1_1);
- s.set_rand_sc2_1(pack_b2(rand_sc2_1));
- s.set_rand_sc3_1(pack_b3(rand_sc3_1));
- s.set_rand_sc4_1(pack_b4(rand_sc4_1));
+ s.set_rand_uc1_1(rand_uc1_1);
+ s.set_rand_uc2_1(pack_s2(rand_uc2_1));
+ s.set_rand_uc3_1(pack_s3(rand_uc3_1));
+ s.set_rand_uc4_1(pack_s4(rand_uc4_1));
s.set_rand_ss1_0(rand_ss1_0);
s.set_rand_ss2_0(pack_s2(rand_ss2_0));
s.set_rand_ss3_0(pack_s3(rand_ss3_0));
@@ -381,6 +381,14 @@ public class UT_math_agree extends UnitTest {
s.set_rand_ss2_1(pack_s2(rand_ss2_1));
s.set_rand_ss3_1(pack_s3(rand_ss3_1));
s.set_rand_ss4_1(pack_s4(rand_ss4_1));
+ s.set_rand_us1_0(rand_us1_0);
+ s.set_rand_us2_0(pack_i2(rand_us2_0));
+ s.set_rand_us3_0(pack_i3(rand_us3_0));
+ s.set_rand_us4_0(pack_i4(rand_us4_0));
+ s.set_rand_us1_1(rand_us1_1);
+ s.set_rand_us2_1(pack_i2(rand_us2_1));
+ s.set_rand_us3_1(pack_i3(rand_us3_1));
+ s.set_rand_us4_1(pack_i4(rand_us4_1));
s.set_rand_si1_0(rand_si1_0);
s.set_rand_si2_0(pack_i2(rand_si2_0));
s.set_rand_si3_0(pack_i3(rand_si3_0));
@@ -389,6 +397,14 @@ public class UT_math_agree extends UnitTest {
s.set_rand_si2_1(pack_i2(rand_si2_1));
s.set_rand_si3_1(pack_i3(rand_si3_1));
s.set_rand_si4_1(pack_i4(rand_si4_1));
+ s.set_rand_ui1_0(rand_ui1_0);
+ s.set_rand_ui2_0(pack_l2(rand_ui2_0));
+ s.set_rand_ui3_0(pack_l3(rand_ui3_0));
+ s.set_rand_ui4_0(pack_l4(rand_ui4_0));
+ s.set_rand_ui1_1(rand_ui1_1);
+ s.set_rand_ui2_1(pack_l2(rand_ui2_1));
+ s.set_rand_ui3_1(pack_l3(rand_ui3_1));
+ s.set_rand_ui4_1(pack_l4(rand_ui4_1));
s.set_rand_sl1_0(rand_sl1_0);
s.set_rand_sl2_0(pack_l2(rand_sl2_0));
s.set_rand_sl3_0(pack_l3(rand_sl3_0));
@@ -397,39 +413,20 @@ public class UT_math_agree extends UnitTest {
s.set_rand_sl2_1(pack_l2(rand_sl2_1));
s.set_rand_sl3_1(pack_l3(rand_sl3_1));
s.set_rand_sl4_1(pack_l4(rand_sl4_1));
- // FIXME: set signed char input vectors once bug is fixed
+ s.set_rand_uc1_0(rand_uc1_0);
+ s.set_rand_uc2_0(pack_s2(rand_uc2_0));
+ s.set_rand_uc3_0(pack_s3(rand_uc3_0));
+ s.set_rand_uc4_0(pack_s4(rand_uc4_0));
+ // FIXME: set char input vectors once bug 6865598 is fixed
/*
s.set_rand_sc1_0(rand_sc1_0);
s.set_rand_sc2_0(pack_b2(rand_sc2_0));
s.set_rand_sc3_0(pack_b3(rand_sc3_0));
s.set_rand_sc4_0(pack_b4(rand_sc4_0));
- */
- // FIXME: set unsigned input vectors once bug 6764163 is fixed
- /*
- s.set_rand_us1_0(rand_us1_0);
- s.set_rand_us2_0(pack_i2(rand_us2_0));
- s.set_rand_us3_0(pack_i3(rand_us3_0));
- s.set_rand_us4_0(pack_i4(rand_us4_0));
- s.set_rand_us1_1(rand_us1_1);
- s.set_rand_us2_1(pack_i2(rand_us2_1));
- s.set_rand_us3_1(pack_i3(rand_us3_1));
- s.set_rand_us4_1(pack_i4(rand_us4_1));
- s.set_rand_uc1_0(rand_uc1_0);
- s.set_rand_uc2_0(pack_s2(rand_uc2_0));
- s.set_rand_uc3_0(pack_s3(rand_uc3_0));
- s.set_rand_uc4_0(pack_s4(rand_uc4_0));
- s.set_rand_uc1_1(rand_uc1_1);
- s.set_rand_uc2_1(pack_s2(rand_uc2_1));
- s.set_rand_uc3_1(pack_s3(rand_uc3_1));
- s.set_rand_uc4_1(pack_s4(rand_uc4_1));
- s.set_rand_ui1_0(rand_ui1_0);
- s.set_rand_ui2_0(pack_l2(rand_ui2_0));
- s.set_rand_ui3_0(pack_l3(rand_ui3_0));
- s.set_rand_ui4_0(pack_l4(rand_ui4_0));
- s.set_rand_ui1_1(rand_ui1_1);
- s.set_rand_ui2_1(pack_l2(rand_ui2_1));
- s.set_rand_ui3_1(pack_l3(rand_ui3_1));
- s.set_rand_ui4_1(pack_l4(rand_ui4_1));
+ s.set_rand_sc1_1(rand_sc1_1);
+ s.set_rand_sc2_1(pack_b2(rand_sc2_1));
+ s.set_rand_sc3_1(pack_b3(rand_sc3_1));
+ s.set_rand_sc4_1(pack_b4(rand_sc4_1));
*/
// TODO: set unsigned long vectors
@@ -438,40 +435,37 @@ public class UT_math_agree extends UnitTest {
s.set_min_rand_f2_f2(pack_f2(min(rand_f2_0, rand_f2_1)));
s.set_min_rand_f3_f3(pack_f3(min(rand_f3_0, rand_f3_1)));
s.set_min_rand_f4_f4(pack_f4(min(rand_f4_0, rand_f4_1)));
+ s.set_min_rand_uc1_uc1(min(rand_uc1_0, rand_uc1_1));
+ s.set_min_rand_uc2_uc2(pack_s2(min(rand_uc2_0, rand_uc2_1)));
+ s.set_min_rand_uc3_uc3(pack_s3(min(rand_uc3_0, rand_uc3_1)));
+ s.set_min_rand_uc4_uc4(pack_s4(min(rand_uc4_0, rand_uc4_1)));
s.set_min_rand_ss1_ss1(min(rand_ss1_0, rand_ss1_1));
s.set_min_rand_ss2_ss2(pack_s2(min(rand_ss2_0, rand_ss2_1)));
s.set_min_rand_ss3_ss3(pack_s3(min(rand_ss3_0, rand_ss3_1)));
s.set_min_rand_ss4_ss4(pack_s4(min(rand_ss4_0, rand_ss4_1)));
+ s.set_min_rand_us1_us1(min(rand_us1_0, rand_us1_1));
+ s.set_min_rand_us2_us2(pack_i2(min(rand_us2_0, rand_us2_1)));
+ s.set_min_rand_us3_us3(pack_i3(min(rand_us3_0, rand_us3_1)));
+ s.set_min_rand_us4_us4(pack_i4(min(rand_us4_0, rand_us4_1)));
s.set_min_rand_si1_si1(min(rand_si1_0, rand_si1_1));
s.set_min_rand_si2_si2(pack_i2(min(rand_si2_0, rand_si2_1)));
s.set_min_rand_si3_si3(pack_i3(min(rand_si3_0, rand_si3_1)));
s.set_min_rand_si4_si4(pack_i4(min(rand_si4_0, rand_si4_1)));
+ s.set_min_rand_ui1_ui1(min(rand_ui1_0, rand_ui1_1));
+ s.set_min_rand_ui2_ui2(pack_l2(min(rand_ui2_0, rand_ui2_1)));
+ s.set_min_rand_ui3_ui3(pack_l3(min(rand_ui3_0, rand_ui3_1)));
+ s.set_min_rand_ui4_ui4(pack_l4(min(rand_ui4_0, rand_ui4_1)));
s.set_min_rand_sl1_sl1(min(rand_sl1_0, rand_sl1_1));
s.set_min_rand_sl2_sl2(pack_l2(min(rand_sl2_0, rand_sl2_1)));
s.set_min_rand_sl3_sl3(pack_l3(min(rand_sl3_0, rand_sl3_1)));
s.set_min_rand_sl4_sl4(pack_l4(min(rand_sl4_0, rand_sl4_1)));
- // FIXME: set signed char min reference vectors once bug is fixed
+ // FIXME: set char min reference vectors once bug 6865598 is fixed
/*
s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
s.set_min_rand_sc2_sc2(pack_b2(min(rand_sc2_0, rand_sc2_1)));
s.set_min_rand_sc3_sc3(pack_b3(min(rand_sc3_0, rand_sc3_1)));
s.set_min_rand_sc4_sc4(pack_b4(min(rand_sc4_0, rand_sc4_1)));
*/
- // FIXME: set unsigned min reference vectors once bug 6764163 is fixed
- /*
- s.set_min_rand_uc1_uc1(min(rand_uc1_0, rand_uc1_1));
- s.set_min_rand_uc2_uc2(pack_s3(min(rand_uc2_0, rand_uc2_1)));
- s.set_min_rand_uc3_uc3(pack_s3(min(rand_uc3_0, rand_uc3_1)));
- s.set_min_rand_uc4_uc4(pack_s4(min(rand_uc4_0, rand_uc4_1)));
- s.set_min_rand_us1_us1(min(rand_us1_0, rand_us1_1));
- s.set_min_rand_us2_us2(pack_i2(min(rand_us2_0, rand_us2_1)));
- s.set_min_rand_us3_us3(pack_i3(min(rand_us3_0, rand_us3_1)));
- s.set_min_rand_us4_us4(pack_i4(min(rand_us4_0, rand_us4_1)));
- s.set_min_rand_ui1_ui1(min(rand_ui1_0, rand_ui1_1));
- s.set_min_rand_ui2_ui2(pack_l2(min(rand_ui2_0, rand_ui2_1)));
- s.set_min_rand_ui3_ui3(pack_l3(min(rand_ui3_0, rand_ui3_1)));
- s.set_min_rand_ui4_ui4(pack_l4(min(rand_ui4_0, rand_ui4_1)));
- */
// TODO: set results for unsigned long min
// Set results for max
@@ -479,40 +473,38 @@ public class UT_math_agree extends UnitTest {
s.set_max_rand_f2_f2(pack_f2(max(rand_f2_0, rand_f2_1)));
s.set_max_rand_f3_f3(pack_f3(max(rand_f3_0, rand_f3_1)));
s.set_max_rand_f4_f4(pack_f4(max(rand_f4_0, rand_f4_1)));
+ s.set_max_rand_uc1_uc1(max(rand_uc1_0, rand_uc1_1));
+ s.set_max_rand_uc2_uc2(pack_s2(max(rand_uc2_0, rand_uc2_1)));
+ s.set_max_rand_uc3_uc3(pack_s3(max(rand_uc3_0, rand_uc3_1)));
+ s.set_max_rand_uc4_uc4(pack_s4(max(rand_uc4_0, rand_uc4_1)));
s.set_max_rand_ss1_ss1(max(rand_ss1_0, rand_ss1_1));
s.set_max_rand_ss2_ss2(pack_s2(max(rand_ss2_0, rand_ss2_1)));
s.set_max_rand_ss3_ss3(pack_s3(max(rand_ss3_0, rand_ss3_1)));
s.set_max_rand_ss4_ss4(pack_s4(max(rand_ss4_0, rand_ss4_1)));
+ s.set_max_rand_us1_us1(max(rand_us1_0, rand_us1_1));
+ s.set_max_rand_us2_us2(pack_i2(max(rand_us2_0, rand_us2_1)));
+ s.set_max_rand_us3_us3(pack_i3(max(rand_us3_0, rand_us3_1)));
+ s.set_max_rand_us4_us4(pack_i4(max(rand_us4_0, rand_us4_1)));
s.set_max_rand_si1_si1(max(rand_si1_0, rand_si1_1));
s.set_max_rand_si2_si2(pack_i2(max(rand_si2_0, rand_si2_1)));
s.set_max_rand_si3_si3(pack_i3(max(rand_si3_0, rand_si3_1)));
s.set_max_rand_si4_si4(pack_i4(max(rand_si4_0, rand_si4_1)));
+ s.set_max_rand_ui1_ui1(max(rand_ui1_0, rand_ui1_1));
+ s.set_max_rand_ui2_ui2(pack_l2(max(rand_ui2_0, rand_ui2_1)));
+ s.set_max_rand_ui3_ui3(pack_l3(max(rand_ui3_0, rand_ui3_1)));
+ s.set_max_rand_ui4_ui4(pack_l4(max(rand_ui4_0, rand_ui4_1)));
s.set_max_rand_sl1_sl1(max(rand_sl1_0, rand_sl1_1));
s.set_max_rand_sl2_sl2(pack_l2(max(rand_sl2_0, rand_sl2_1)));
s.set_max_rand_sl3_sl3(pack_l3(max(rand_sl3_0, rand_sl3_1)));
s.set_max_rand_sl4_sl4(pack_l4(max(rand_sl4_0, rand_sl4_1)));
- // FIXME: set signed char max reference vectors once bug is fixed
+ // FIXME: set signed char max reference vectors once bug 6865598 is fixed
/*
s.set_max_rand_sc1_sc1(max(rand_sc1_0, rand_sc1_1));
s.set_max_rand_sc2_sc2(pack_b2(max(rand_sc2_0, rand_sc2_1)));
s.set_max_rand_sc3_sc3(pack_b3(max(rand_sc3_0, rand_sc3_1)));
s.set_max_rand_sc4_sc4(pack_b4(max(rand_sc4_0, rand_sc4_1)));
*/
- // FIXME: set unsigned max reference vectors once bug 6764163 is fixed
- /*
- s.set_max_rand_uc1_uc1(max(rand_uc1_0, rand_uc1_1));
- s.set_max_rand_uc2_uc2(pack_s3(max(rand_uc2_0, rand_uc2_1)));
- s.set_max_rand_uc3_uc3(pack_s3(max(rand_uc3_0, rand_uc3_1)));
- s.set_max_rand_uc4_uc4(pack_s4(max(rand_uc4_0, rand_uc4_1)));
- s.set_max_rand_us1_us1(max(rand_us1_0, rand_us1_1));
- s.set_max_rand_us2_us2(pack_i2(max(rand_us2_0, rand_us2_1)));
- s.set_max_rand_us3_us3(pack_i3(max(rand_us3_0, rand_us3_1)));
- s.set_max_rand_us4_us4(pack_i4(max(rand_us4_0, rand_us4_1)));
- s.set_max_rand_ui1_ui1(max(rand_ui1_0, rand_ui1_1));
- s.set_max_rand_ui2_ui2(pack_l2(max(rand_ui2_0, rand_ui2_1)));
- s.set_max_rand_ui3_ui3(pack_l3(max(rand_ui3_0, rand_ui3_1)));
- s.set_max_rand_ui4_ui4(pack_l4(max(rand_ui4_0, rand_ui4_1)));
- */
+
// TODO: set results for unsigned long max
// Set results for fmin
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
index ac3a3fa9b617..1adb036fca26 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
@@ -337,15 +337,16 @@ TEST_UL3_UL3(func) \
TEST_UL4_UL4(func)
#define TEST_VEC_VEC_ALL(func) \
-TEST_FN_FN_ALL(func) \
+TEST_FN_FN_ALL(func) \
+TEST_UC_UC_ALL(func) \
TEST_SS_SS_ALL(func) \
-TEST_SI_SI_ALL(func)
-// FIXME: Add tests back in once bug 6764163 is fixed
-#if 0
-TEST_SC_SC_ALL(func) \
TEST_US_US_ALL(func) \
-TEST_UC_UC_ALL(func) \
+TEST_SI_SI_ALL(func) \
TEST_UI_UI_ALL(func)
+
+// FIXME: Add char tests back in once bug 6865598 is fixed
+#if 0
+TEST_SC_SC_ALL(func)
#endif
// TODO: add long types to ALL macro
#if 0
diff --git a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java
index 8868c65e59a8..6ccdcb6d2bf5 100644
--- a/tools/layoutlib/bridge/src/android/view/Display_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/Display_Delegate.java
@@ -31,57 +31,4 @@ import android.os.RemoteException;
*/
public class Display_Delegate {
- // ---- Overridden methods ----
-
- @LayoutlibDelegate
- public static IWindowManager getWindowManager() {
- return RenderAction.getCurrentContext().getIWindowManager();
- }
-
- // ---- Native methods ----
-
- @LayoutlibDelegate
- /*package*/ static int getDisplayCount() {
- return 1;
- }
-
- @LayoutlibDelegate
- /** @hide special for when we are faking the screen size. */
- /*package*/ static int getRawWidthNative(Display theDisplay) {
- // same as real since we're not faking compatibility mode.
- return RenderAction.getCurrentContext().getIWindowManager().getMetrics().widthPixels;
- }
-
- @LayoutlibDelegate
- /** @hide special for when we are faking the screen size. */
- /*package*/ static int getRawHeightNative(Display theDisplay) {
- // same as real since we're not faking compatibility mode.
- return RenderAction.getCurrentContext().getIWindowManager().getMetrics().heightPixels;
- }
-
- @LayoutlibDelegate
- /*package*/ static int getOrientation(Display theDisplay) {
- try {
- // always dynamically query for the current window manager
- return getWindowManager().getRotation();
- } catch (RemoteException e) {
- // this will never been thrown since this is not a true RPC.
- }
-
- return Surface.ROTATION_0;
- }
-
- @LayoutlibDelegate
- /*package*/ static void nativeClassInit() {
- // not needed for now.
- }
-
- @LayoutlibDelegate
- /*package*/ static void init(Display theDisplay, int display) {
- // always dynamically query for the current window manager
- BridgeWindowManager wm = RenderAction.getCurrentContext().getIWindowManager();
- theDisplay.mDensity = wm.getMetrics().density;
- theDisplay.mDpiX = wm.getMetrics().xdpi;
- theDisplay.mDpiY = wm.getMetrics().ydpi;
- }
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
index 3e56b6057194..2619dd85ba22 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
@@ -29,6 +29,7 @@ import android.os.IRemoteCallback;
import android.os.RemoteException;
import android.util.DisplayMetrics;
import android.view.Display;
+import android.view.DisplayInfo;
import android.view.Display_Delegate;
import android.view.Gravity;
import android.view.IApplicationToken;
@@ -69,23 +70,6 @@ public class BridgeWindowManager implements IWindowManager {
return mRotation;
}
- @Override
- public int getMaximumSizeDimension() throws RemoteException {
- return 0;
- }
-
- @Override
- public void getCurrentSizeRange(Point smallestSize, Point largestSize) {
- }
-
- @Override
- public void getDisplaySize(Point arg0) throws RemoteException {
- }
-
- @Override
- public void getRealDisplaySize(Point arg0) throws RemoteException {
- }
-
// ---- unused implementation of IWindowManager ----
@Override
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java
index 1d71e1bc8ff0..691eca7839af 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java
@@ -45,7 +45,24 @@ public final class BridgeWindowSession implements IWindowSession {
}
@Override
- public int addWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2, Rect arg3)
+ public int addToDisplay(IWindow arg0, int seq, LayoutParams arg1, int arg2, int displayId,
+ Rect arg3, InputChannel outInputchannel)
+ throws RemoteException {
+ // pass for now.
+ return 0;
+ }
+
+ @Override
+ public int addWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2,
+ Rect arg3)
+ throws RemoteException {
+ // pass for now.
+ return 0;
+ }
+
+ @Override
+ public int addToDisplayWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2,
+ int displayId, Rect arg3)
throws RemoteException {
// pass for now.
return 0;
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 84b850706d3e..75bd6e270ea5 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1579,7 +1579,7 @@ public class WifiStateMachine extends StateMachine {
/**
* Record the detailed state of a network.
- * @param state the new @{code DetailedState}
+ * @param state the new {@code DetailedState}
*/
private void setNetworkDetailedState(NetworkInfo.DetailedState state) {
if (DBG) {